I've never heard of an OOP design pattern called Flair.  From the class
you've pasted, it looks like a novice attempt at implementating a design
pattern known as Decorator.

Perhaps they were trying to be funny with a reference to the movie
Office Space where buttons decorating a TGIFriday's uniform were called
Flair?  I know that comedy helps when teaching dry material, but
renaming a design pattern like that seems to me to be confusing at best.

At any rate, here is a link to a description of the Decorator pattern.
It should get you on your way.

http://en.wikipedia.org/wiki/Decorator_pattern





> 
> SNAPFLAIR CLASS
> Implemented as a Singleton
> 
> class  SnapFlair {
>       private static var _obj:SnapFlair;
>       
>       private function SnapFlair() {}
>       
>       /**
>       * @param target                 The MovieClip being 'flaired'
>       * @param source                 The source of the event 
> that the flair  
> functionality is listening for
>       * @param eventName      The name of the event that the 
> flair is listening  
> for
>       */      
>       public function snapOn( target:MovieClip, 
> source:Object, eventName:String ) {
>               target.mc.$snapFlair = new Object();
>               target.mc.$snapFlair._obj = target;
>               source.addEventListener( eventName, target.$snapFlair );
>               target.mc.$snapFlair[eventName] = onEvent;
>       }
>       
>       public static function getObj():SnapFlair {
>               if (SnapFlair._obj == null) {
>                       SnapFlair._obj = new SnapFlair();
>               }
>               return _obj;
>       }
>       
>       public function snapOff( target:MovieClip, 
> source:Object, eventName:String ) {
>               source.removeEventListener(eventName, target.$snapFlair)
>               delete target.mc.$snapFlair;
>       }
>       
>       public function onEvent( evt:Object ) {
>               // do stuff
>       }
>       
>       public function toString():String {
>               return "Class SnapFlair";
>       }
> }
> 
> 
> _______________________________________________
> [email protected]
> To change your subscription options or search the archive:
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
> 
> Brought to you by Fig Leaf Software
> Premier Authorized Adobe Consulting and Training 
> http://www.figleaf.com http://training.figleaf.com
> 
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to