I have base application class:

package {

    import mx.controls.ComboBox;
    import mx.core.Application;

    public class ExampleBase extends Application {
       
        public var myComboBox : ComboBox;
       
        public function ExampleBase() {
        }
       
        protected function onEditStateEnter() : void {
            myComboBox.open();
        }
   
    }

}

and inherited MXML:

<?xml version="1.0" encoding="utf-8"?>
<ExampleBase xmlns:mx="http://www.adobe.com/2006/mxml"
    xmlns="*"
    currentState="viewState">
   
    <states>
        <mx:State name="viewState">
            <mx:AddChild relativeTo="{this}" position="lastChild">
                <mx:target>
                    <mx:Text id="myLabel" selectable="true" text="Yo!" click="currentState = 'editState'" />
                </mx:target>
            </mx:AddChild>
        </mx:State>
        <mx:State name="editState" enterState="onEditStateEnter()">
            <mx:AddChild relativeTo="{this}" position="lastChild">
                <mx:target>
                    <mx:HBox id="myHBox">
                        <mx:ComboBox id="myComboBox" dataProvider="{[1, 2, 3]}" />
                        <mx:Button label="Exit" click="currentState = 'viewState'" />
                    </mx:HBox>
                </mx:target>
            </mx:AddChild>
        </mx:State>
    </states>
   
</ExampleBase>

You can find call enterState="onEditStateEnter()" there and myComboBox.open(); in method implementation. The problem is that ComboBox is opened only second time you enter the state. When I debugged I found that upon the first state appearance dropdown property of ComboBox is null. What's wrong with my example?
__._,_.___

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com





SPONSORED LINKS
Web site design development Computer software development Software design and development
Macromedia flex Software development best practice


YAHOO! GROUPS LINKS




__,_._,___

Reply via email to