topical media & game development

talk show tell print

professional-flex-code-14-ButtonLabel.ax

professional-flex-code-14-ButtonLabel.ax [swf] flex


  package
  {
          import mx.controls.Button;
          import flash.events.Event;
          // Define the custom event
          [Event(name="labelChanged", type="flash.events.Event")]
          [Effect(name="labelChangedEffect", event="labelChanged")]
          public class @ax-professional-flex-code-14-ButtonLabel extends Button {
            // property to hold label value
            private var _myLabel:String;
      // public setter method        
            public function set myLabel(s:String):void {
              _myLabel = s;
              this.label = s;
              // Create and dispatch custom event
              var eventObj:Event = new Event("labelChanged");
              dispatchEvent(eventObj);
            }
          }
  }


(C) Æliens 04/09/2009

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.