[原]一种随机类的方法

2008-11-26 11:22:13 原创 抢沙发(1)

此类方法用于类似图片的类进行随机实力化,或者拥有同个接口或同个父类的功能函数,实现某种随机

当然,这里随机的方式不做讨论,可以参阅之前本人的 48位线性同余算法的 [原]关于股子系统的优化

完整代码:
 

  1. package  {  
  2.     import flash.utils.getDefinitionByName;  
  3.       
  4.     /**  
  5.      * ...  
  6.      * @author Telds[KingFo]  
  7.      */ 
  8.     public class SampleImage {  
  9.           
  10.         [Embed(source = '../assets/building/image0.png')]public static const BUILDING_0:Class;  
  11.         [Embed(source = '../assets/building/image1.png')]public static const BUILDING_1:Class;  
  12.         [Embed(source = '../assets/building/image2.png')]public static const BUILDING_2:Class;  
  13.         [Embed(source = '../assets/building/image3.png')]public static const BUILDING_3:Class;  
  14.         [Embed(source = '../assets/building/image4.png')]public static const BUILDING_4:Class;  
  15.         [Embed(source = '../assets/building/image5.png')]public static const BUILDING_5:Class;  
  16.         [Embed(source = '../assets/building/image6.png')]public static const BUILDING_6:Class;  
  17.         [Embed(source = '../assets/building/image7.png')]public static const BUILDING_7:Class;  
  18.         [Embed(source = '../assets/building/image8.png')]public static const BUILDING_8:Class;  
  19.         [Embed(source = '../assets/building/image9.png')]public static const BUILDING_9:Class;  
  20.         [Embed(source = '../assets/building/image10.png')]public static const BUILDING_10:Class;  
  21.         [Embed(source = '../assets/building/image11.png')]public static const BUILDING_11:Class;  
  22.         [Embed(source = '../assets/building/image12.png')]public static const BUILDING_12:Class;  
  23.           
  24.         public static function getRandomImageClass():Class {  
  25.             var n:String = "SampleImage_BUILDING_";  
  26.             var i:int = Math.random() * 12;  
  27.             n = n.concat(i);  
  28.             return getDefinitionByName(n) as Class;  
  29.         }  
  30.           
  31.     }  
  32.       

至于如何知道完全限定类名

可以使用以下类进行测试获取,这里值得一提的是我上面的写法是比较特殊例子,至于为什么特殊就留着看客您琢磨了~~~
 

  1. flash.utils.getQualifiedClassName ()  

 

Lita - SQLite Administration Tool (For AIR)

2008-11-11 9:31:52 开发者 抢沙发(0)

Dowload Here

 

Main Features

  • An administration tool for your AIR SQLite Database
  • Open, create, compact databases
  • Create, rename, delete, and empty tables
  • Create, rename and delete columns
  • Create, modify and delete records
  • Easily run your custom SQL statements
  • Create and delete indices
  •  

APNG?

2008-11-11 0:18:44 开发者 抢沙发(0)

嗯,没错就是一个扩展PNG(Portable Network Graphics)的新格式APNG(Animated Portable Network Graphics)!!

产生的意义也就不说了,此文件生于2004年,直到2007年才被所谓的主流浏览器给加入到机制中。

不过本人还是比较怀疑的是APNG是否能成为标准??

用于Web上,如果IE不支持,尤其像大部分国内普通用户是“忠实”的IE Fans......

自SWF针对位图方法做了较多优化,想必大多数网站都会采用SWF作为位图的逐帧动画了吧~~

至于如何替代GIF?貌似某组织几个老顽固一直坚持只要是和PNG爷爷扯上关系的,就必须只能表现一张图....

不过,目前支持的浏览器倒是有了FF3 和 第九代小O同学了~~~  有兴趣的话可以看下后面的图片~~~

未来谁知道呢?也许哪天弄个简单的解码器尝试下吧~~~  或许目前作为某种加密也不错~~~

啊,今天又是新的一天啦~~~ 期待着向某人索要JS写的解码器看看,不知道是不是仅仅在传说中.......

PS:
数了下这个PNG的帧标签~~~ 靠~~ 25帧............ 千万要记得用FF3+~~~或者Opera9.5+

Using BMPDecoder class to Load an External BMP File(RLE Compression Support)

2008-11-9 13:43:49 开发者 抢沙发(0)

原文:http://ntt.cc/2008/10/01/using-bmpdecoder-class-to-load-an-external-bmp-file-rle-compression-support.html

下载 BMPDecoder

用例:
 

  1. function loadBMPFile( url:String ):void {   
  2.   var loader:URLLoader = new URLLoader();   
  3.   loader.dataFormat = URLLoaderDataFormat.BINARY;   
  4.   loader.addEventListener( Event.COMPLETE, onCompleteLoad );   
  5.   loader.load( new URLRequest( url ) );   
  6. }   
  7. function onCompleteLoad( e:Event ):void {   
  8.   var loader:URLLoader = e.target as URLLoader;   
  9.   var decoder:BMPDecoder = new BMPDecoder();   
  10.   var bd:BitmapData = decoder.decode( loader.data );   

[原]关于AS3的MovieClip的addFrameScript()方法个人理解

2008-9-4 23:23:57 原创 抢沙发(0)

网络上都早有了此方法的描述,但是描述的并不太在正确
网络的描述是这样的:
 

  1. addFrameScript(frame:unit,notify:Function):void


相信很多人都尝试过以下输出公共方法的函数
 

  1. describeType(); 

所以通过解析可以明显的看出来是类似:
 

  1. addFrameScript(...args):void

可以理解成为:
 

  1. addFrameScript(frame:Object, notify:Function):void

实际上我的猜测是

 

  1. //伪码  
  2. function addFrameScript(..args):void{  
  3.     var i:int=0;  
  4.     var frame:Object  
  5.     var notify::Function  
  6.     for(;i<args.length;i+=2){  
  7.        frame=args[i];  
  8.        notify=args[i+1];
  9.  //TODO:  
  10.  }  
  11.  

 用法:
 

  1. addFrameScript("frameLabel",func);  
  2. //或  
  3. addFrameScript(1,func); 

 

Alternativa3D 5.0.3 and Flash Player 10 version

2008-8-2 21:00:35 新闻 抢沙发(0)

Alternativa3D 5.0.3 and Flash Player 10 version

31.07.2008 Anton Volkov

There is the Alternativa3D 5.0.3 update on the site.

Changelog:

  • OBJ-models loader added
  • Mesh setMaterialToAllSurfaces method renamed to cloneMaterialToAllSurfaces
  • Method close added to Loader3DS, manually interrupting uploading
  • Texture parameters made only for reading
  • Bug fixed - there were no redrawing after faces UV-coordinates update
  • Added indication of missing or incorrect UV-mapping doing texture drawing
  • Optimized memory usage for collision detection
  • Documentation updated

Since this version there will be two versions of Alternativa3D in our package, adapted for Flash Player 9 and 10 accordingly.

Also our documentation now can be integrated into Eclipse as a plug-in. It can be install directly from Eclipse, by setting address http://help.alternativaplatform.com as an update website.

Eclipse 3.3: Help > Software Updates > Find and Install > Search for new features to install > New Remote Site…

Eclipse 3.4: Help > Software Updates > Available Software > Add Site…