In the post Flash CS3: Create a reflex effect on any MovieClip we saw how you can write a class that extends MovieClip, to connect it to DesignTime to any MovieClip in the library. I discovered, however, that may be more useful and economical path to the contrary. I created a class Reflex ( Reflex.as ), with the intention of using it exclusively by code. I created this class thinking of moving the pointer in the constructor to a MovieClip. , ma leggermente modificato in modo da poter funzionare espressamente da codice: The new class Reflex contains essentially the same code inserted in the first ReflexMe , but slightly modified so as to work specifically by code:
1 2 3 4 | / / sfx .*; undolibrary imports. .* sfx; / / Reflex = new Reflex ( movieClipInstance ) ; var rx: = new Reflex Reflex (movieClipInstance); |
Where movieClipInstance is a pointer to a MovieClip. Or, alternatively, if you have a MovieClip in the library exported:
1 2 3 4 5 6 7 | / / sfx .*; undolibrary imports. .* sfx; / / Simbolo1 = new Simbolo1 ( ) ; var mc: Simbolo1 Simbolo1 = new (); Reflex = new Reflex ( mc ) ; var rx: = new Reflex Reflex (mc); / / mc ) ; addChild (mc); |
To avoid duplicating the code, it is possible to reconstruct a class ReflexMe able to work directly in DesignTime? Just create a class ( ReflexMe.as ) to extend the class Reflex :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | sfx { undolibrary package. sfx { / * ** @ Name: ReflexMe.as ** @ Description: Make a Reflex Effect On Any MovieClip ** @ Author: undo = = ** @ Web: http://www.undolog.com ** @ Email: @ g.fazioli undolog.com ** ** @ Ver: 1.0 * / ReflexMe extends Reflex { Reflex {public class extends ReflexMe ReflexMe ( ) : void { public function ReflexMe (): void { / / Call the manufacturer of Reflex this ) ; super (this); } } } |
Sources
Find all the code and examples of Undolibrary











There are no comments for this post
Leave a comment