I found that myComboBox is not initialized when onEditStateEnter() is
running, so I could use workaround like:

protected function onEditStateEnter() : void {
if (myComboBox.initialized) {
onEditStateInitialize();
} else {
myComboBox.addEventListener(FlexEvent.INITIALIZE, onEditStateInitialize);
}
}

Are there any better solutions? :)

On 7/21/06, Sergey Kovalyov <[EMAIL PROTECTED]> wrote:
> 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?
>


------------------------ Yahoo! Groups Sponsor --------------------~--> 
See what's inside the new Yahoo! Groups email.
http://us.click.yahoo.com/2pRQfA/bOaOAA/yQLSAA/nhFolB/TM
--------------------------------------------------------------------~-> 

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

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to