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:

ActionScript
  1. / /
  2. sfx .*; import undolibrary. sfx .*;
  3. / /
  4. 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:

ActionScript
  1. / /
  2. sfx .*; import undolibrary. sfx .*;
  3. / /
  4. Simbolo1 = new Simbolo1 ( ) ; var mc: Simbolo1 = new Simbolo1 ();
  5. Reflex   = new Reflex ( mc ) ; var rx: = new Reflex Reflex (mc);
  6. / /
  7. 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

ActionScript
  1. sfx { undolibrary Package. (sfx
  2. / *
  3. ** @ Name: ReflexMe.as
  4. ** @ Description: Make a Reflex Effect on any MovieClip
  5. ** @ Author: = undo =
  6. ** @ Web: http://www.undolog.com
  7. ** @ Email: @ g.fazioli undolog.com
  8. **
  9. ** @ Ver: 1.0
  10. * /
  11. ReflexMe extends Reflex { public class extends ReflexMe Reflex (
  12. ReflexMe ( ) : void { public function ReflexMe (): void (
  13. / / Call the constructor of Reflex
  14. this ) ; super (this);
  15. )
  16. )
  17. )

Sources

You can find all the code and examples on Undolibrary

Related Post

Was this article helpful?: Per nientePocoAbbastanzaMoltoMoltissimo
Loading ... Loading ...

There are no comments for this post

Leave a comment

TAG XHTML PERMISSIONS: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> INSERTION CODE:
 <pre></pre>         // blocco generico [code][/code]       // blocco generico [as][/as]           // Actionscript [css][/css]         // CSS Style Sheet [html][/html]       // HTML [js][/js]           // Javascript [objc][/objc]       // Objective-C [php][/php]         // PHP [sql][/sql]         // SQL