Reflex and ReflexMe: from class to class based
Friday, June 13, 2008 In the post Flash CS3: Create a reflex effect on any MovieClip seen how can we write a class that extends a MovieClip to connect to DesignTime to any MovieClip in the library. I discovered, however, that may prove more useful and economical route to the contrary. I created a class Reflex (Reflex.as), with the intention of using it solely from code. I created this class thinking of moving the pointer in the constructor to a MovieClip. The new class Reflex contains essentially the same code inserted in the first ReflexMe but slightly modified to allow them to function explicitly from code:
- / /
- sfx .*; import undolibrary. 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 exported library:
- / /
- sfx .*; import undolibrary. sfx .*;
- / /
- Simbolo1 = new Simbolo1 ( ) ; var mc: Simbolo1 = new Simbolo1 ();
- Reflex = new Reflex ( mc ) ; var rx: = new Reflex Reflex (mc);
- / /
- mc ) ; addChild (mc);
In order not to duplicate the code, how can we rebuild a class ReflexMe able to work directly in DesignTime? Just create a class (ReflexMe.as) that extends the class Reflex
- 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 { public class extends ReflexMe Reflex (
- ReflexMe ( ) : void { public function ReflexMe (): void (
- / / Call the constructor of Reflex
- this ) ; super (this);
- )
- )
- )
Sources
You can find all the code and examples on Undolibrary














There are no comments for this post
Leave a comment