(1) interactivepng class
Make transparent pixels in PNG images no longer respond to mouse interaction.
Usage: In the flash library, set the movieclip "link property" base class containing PNG images to the interactivepng class.
Download: interactivepng_00000.zip
(2) stats class
This allows you to easily view the current SWF status: FPS, memory usage. Very convenient.
As3 code
- Addchild (new stats ());
- Addchild (new stats ({BG: 0x202020, FPS: 0xc0c0c0, Ms: 0x505050, Mem: 0x707070, memmax: 0xa0a0a0 }));
(3) fontloader class
If you want to apply a non-system font to the dynamic text in SWF, the method is to embed the corresponding font in the SWF. Another method is to embed the font into another SWF, when the corresponding font is required, load the SWF and reference the corresponding font. Fontloader is a font loading class that helps you implement this process.
In fonts.swf:
As3 code
- VaR _ Loader: fontloader = new fontloader ();
- _ Loader. Load (New URLRequest ('fonts.swf '));
After loading, You can reference the font:
As3 code
- VaR fonts = _ loader. fonts; var TF: textformat = new textformat (fonts [0]. fontname, 20 );
Download: http://code.google.com/p/collisiondetectionkit/
(4) collision detection kit
A collision detection toolkit written by as3. Detection Based on pixels and shapes is supported.
Download: http://code.google.com/p/collisiondetectionkit/
(5) swfupload class library
Swfupload is a JS + flash class library, which enables flash upload and retrieval progress and achieves Ajax-like effects without page overloading.
Usage, introduce the JS file:
As3 code
- <SCRIPT src = "http://www.swfupload.org/swfupload.js" type = "text/JavaScript"> </SCRIPT>
Create a swfupload object and specify the SWF. The SwF calls up the upload dialog box through the filereference class. Then, it is handed over to Js.
As3 code
- VaR swfu = new swfupload ({upload_url: "http://www.swfupload.org/upload.php", flash_url: "http://www.swfupload.org/swfupload.swf", file_size_limit: "200 MB", upload_start_handler: uploadstarteventhandler, Handler: Handler });
Download: http://code.google.com/p/swfupload/downloads/list
(6) bitmap mosaic class
Create a pixel bitmap for the Display object.
As3 code
- VaR mymoz: Mosaic = new mosaic (yourdisplayobj );
- Mymoz. pixelsize = 10;
- Mymoz. Render ();
Download: mosaic.zip
(7) Object pool class
Flash Player has two overhead operations: Object creation and garbage collection ). If we store unnecessary objects in an object pool, we can directly obtain the objects of the same type from the object pool. In this way, the "Object creation" can be reduced, and the garbage collection mechanism does not work in the object pool, thus reducing the overhead.
Usage:
Get an instance of someclass from objectpool:
As3 code
- VaR OBJ: someclass = objectpool. GetObject (someclass );
If you do not need an object, store it in the object pool:
As3 code
- Objectpool. disposeobject (OBJ );
Download: objectpool.zip
(8) swfwheel class
Resolve the conflict between the middle mouse button and the browser. Declare the js method in the as code and call it through externalinterface. Other JS files are not required at all.
As3 code
- Swfwheel. initialize (this. stage );
Download: swfwheel.
(9) greenthread class
It dynamically allocates a number of computations (in the thread simulation mode) to multiple frames for computation to avoid the phenomenon of "frame cards. such as search algorithms, graphic Encoding algorithms, and massive data parsing. very useful.
You need to customize the subclass of greenthread extension and put the main cyclic computing in the run function.
As3 code
- VaR astar: astargreenthread = new astargreenthread ();
- Astar. addeventlistener (event. Complete, onfindpath );
- Astar. Star ();
Download: greenthreads-1.0.zip
Reprint address: http://uh.9ria.com/space.php? Uid = 3216 & Do = Blog & id = 3764