我有以下 MXML:
<mx:State name="myState">
<mx:AddChild relativeTo="{myhbox}" position="after">
<mx:Box verticalAlign="middle" horizontalAlign="center" width="100%" height="100%">
<mx:Form id="myForm" width="479" verticalScrollPolicy="off" horizontalScrollPolicy="off">
<mx:FormItem label="My Label:" fontWeight="bold" id="myLabel" direction="vertical">
<mx:TextInput id="myTextInput" width="282" />
<mx:HBox>
<mx:Button label="Go" click="go();" id="goButton" />
</mx:HBox>
</mx:FormItem>
</mx:Form>
</mx:Box>
</mx:AddChild>
</mx:State>
如何使用 <mx:SetProperty/> 将焦点设置在 TextInput 字段上?我尝试了以下方法,但它只会导致该字段被突出显示——光标不会出现在 TextInput 中:
<mx:SetProperty target="{stage}" name="focus" value="{myTextInput}"/>
长话短说,我希望光标出现在该字段中。
更新:我想通了。请参阅评论以获取解决方案。