I have a strange problem: i have the following class:

>>>
package fs.examples.components
{
        import flash.events.Event;
        import flash.events.MouseEvent;
        import flash.text.TextField;
        
        import mx.events.StateChangeEvent;
        import mx.flash.UIMovieClip;

        public class StatefulBase extends UIMovieClip
        {

                private var _label:String;
                private var _labelTextField:TextField;

                [Bindable("labelChanged")]
                public function get label():String
                {
                        return this._labelTextField.text;
                }

                public function set label(value:String):void
                {
                        if (value == this._label)
                        {
                                return;
                        }
                        this._label = value;
                        this._labelTextField.text = this._label;
                        this.dispatchEvent(new Event("labelChanged"));
                }

                public function StatefulBase()
                {
                        super();
                        this.initializeComponent();
                }

                private function eventListener(event:Event):void
                {
                        switch(event.type)
                        {
                                case StateChangeEvent.CURRENT_STATE_CHANGE:
                                        this._labelTextField.text = this._label;
                                        break;
                                case MouseEvent.MOUSE_OUT:
                                        this.currentState = "out";
                                        break;
                                case MouseEvent.MOUSE_OVER:
                                        this.currentState = "over";
                                        break;
                        }
                }

                protected function initializeComponent():void
                {
                        if (this.hasOwnProperty("labelText"))
                        {
                                if (this["labelText"] is TextField)
                                {
                                        this._labelTextField = 
TextField(this["labelText"]);
                                }
                        }
                        
this.addEventListener(StateChangeEvent.CURRENT_STATE_CHANGE, 
eventListener);
                        this.addEventListener(MouseEvent.MOUSE_OUT, 
eventListener);
                        this.addEventListener(MouseEvent.MOUSE_OVER, 
eventListener);
                }
        }
}
>>>

This is the superclass of a symbol made in Flash. The symbol has 2 keyframes 
and in each 
is a textfield with the same instancename. When i initially set the text in 
Flex, it is 
displayed correctly. But after the first time the state changed, i am not able 
to set the text 
property of the TextField instances? Both instances exist... the cursor 
changes... the states 
change as well: visual feedback and correct traces (which i deleted before 
posting the 
code),

-> Why can't just set the text property, when the eventlistener was invoked 
with a StateChangeEvent.CURRENT_STATE_CHANGE?

Best regards and thanx in advance!

Reply via email to