Ha! That's rad. 

I guess the trick is writing a Flash app to write the bulk of the code...
Got links to any of those? 

;)


-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Muzak
Sent: Saturday, June 02, 2007 5:54 PM
To: [email protected]
Subject: Re: [Flashcoders] AS 2 Delegate question

This isn't about quick and easy, but about encapsulation, OOP and best
practices.
Quick and easy also often means quick and dirty ;-)

Here's a stripped down version of a custom button.

import mx.events.EventDispatcher;
import mx.utils.Delegate;

class com.muzakdeezign.samples.MyButton extends MovieClip {
 // decorate class with EventDispatcher
 private static var dispatcherInit =
EventDispatcher.initialize(com.muzakdeezign.samples.MyButton.prototype);

 // declare EvenDispatcher methods
 public var addEventListener:Function;
 public var removeEventListener:Function;
 public var dispatchEvent:Function;

 private var back_mc:MovieClip;

 private var __index:Number;

 function MyButton() {
  this.init();
 }

 private function init():Void {
  this.back_mc.onRelease = Delegate.create(this, this.backReleaseHandler);
 }

 private function backReleaseHandler():Void {
  this.dispatchEvent({type:"click"});
 }

 private function setIndex():Void {
 }

 function get index():Number {
  return this.__index;
 }
 function set index(val:Number):Void {
  this.__index = val;
  this.setIndex();
 }

}

Here's a screencast making the above:
http://muzakdeezign.com/flashcoders/create_component/MyButton.html

regards,
Muzak


----- Original Message ----- 
From: "Jesse Graupmann" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Sunday, June 03, 2007 1:43 AM
Subject: RE: [Flashcoders] AS 2 Delegate question


> Muzak,
>
> You bring this up every time proxy is mentioned. Do you mind sharing an
> actual code example that is just as quick and easy?
>
> Hasta,
> Jesse


_______________________________________________
[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