12/18/2009 8:03:26 AM
Title:
Setting tab index in swc file
I create a registration panel in flash and convert SWC file. im used SWC file in flex. but i cannot tab navigate from one control to another i.e., when im press the tab key the cursor cannot move from tone textbox to another textbox control
Inder
Points: 3010
Posts:0
12/18/2009 11:36:28 AM
To make tab order work as you desire , you should set the tabIndex property of your textboxes. Set tabIndex property of your first textbox to 1 and the second one to 2 and so on in the order you want them . Do not use same tabIndex value for more than one component.
12/18/2009 11:48:36 PM
I already set a tab index for swc file but it cannot work. actually i use flash to design the registeration panel and convert to swc file and use it in flex with tab index. but it not work well. give me a sample one..
the code as follows
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="init()">
<mx:Script>
<![CDATA[
import mx.containers.FormItem;
import mx.containers.Form;
import mx.core.UIComponent;
import flash.display.MovieClip;
import peppy_fla.MainTimeline;
private var sample:Register_New=new Register_New(); // from swc file
public function init():void
{
var uic:UIComponent=new UIComponent;
sample.userName.parent.tabIndex=1;
sample.userName.parent.tabEnabled=true;
sample.userPass.parent.tabIndex=2;
sample.userPass.parent.tabEnabled=true;
sample.userEmail.parent.tabIndex=3;
sample.userEmail.parent.tabEnabled=true;
this.addChild(uic);
uic.addChild(sample);
}
]]>
</mx:Script>
</mx:Application>
Inder
Points: 3010
Posts:0
12/19/2009 11:16:35 AM
you are setting tabIndex sample.userName.parent.tabIndex=1
userName is textbox?
you need to set tabIndex of the textbox and not the parent. Trace and see who the parent is
12/21/2009 2:45:16 AM
i also set tabIndex for the textbox instead of parent. it not working. give me the specific answer with code
12/21/2009 4:13:24 AM
set tab index like this
<?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"> <mx:TextInput x="122" y="38" tabIndex="1" text="tabIndex 1"/> <mx:TextInput x="122" y="94" tabIndex="3" text="tabIndex 3"/> <mx:TextInput x="122" y="149" tabIndex="2" text="tabIndex 2"/> <mx:Button x="122" y="195" label="tabIndex 4" tabIndex="4"/> </mx:Application>
Inder
Points: 3010
Posts:0
12/21/2009 4:29:00 AM
if you can upload your project source files to some location , mxml and flash source for swc , then i can check the problem .
3/12/2011 2:14:54 AM
i created a loginpage but the tab is not working there.can please anyone help.thanks in advance
Insert Code here
<?xml version="1.0" encoding="utf-8"?>
<mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml"
width="100%"
height="100%"
verticalAlign="middle"
horizontalAlign="center">
<mx:Script>
<![CDATA[
import com.tel.model.EventConstants;
import mx.controls.Alert;
import mx.managers.CursorManager;
import mx.rpc.events.FaultEvent;
import mx.rpc.events.ResultEvent;
import mx.rpc.http.mxml.HTTPService;
private var httpService:HTTPService;
public var userID:String = "";
public function init():void{
}
private function mouseClickSubmit():void{
if(userName.text != "" && password.text != ""){
userID = userName.text;
initService();
}else{
if(userName.text == ""){
Alert.show("Please enter 'User Name'.","Alert!")
}else if(password.text == ""){
Alert.show("Please enter 'Password'.","Alert!")
}
}
}
private function initService():void{
var params:Object = new Object();
params["userName"] = userName.text;
params["password"] = password.text;
httpService = new HTTPService();
httpService.showBusyCursor = true;
httpService.resultFormat = "xml";
httpService.method=URLRequestMethod.POST;
httpService.addEventListener(ResultEvent.RESULT, httpServiceResultHandler);
httpService.addEventListener(FaultEvent.FAULT, httpServiceFaultHandler);
httpService.url = "Login.action";
httpService.send(params);
}
private var boolFirstRun = true;
private function httpServiceResultHandler(event:ResultEvent):void{
httpService.removeEventListener(ResultEvent.RESULT, httpServiceResultHandler);
httpService.removeEventListener(FaultEvent.FAULT, httpServiceFaultHandler);
httpService = null;
var resultXML:XML = new XML(event.result.toString());
if(resultXML.children().toString() == "true"){
boolFirstRun = false;
dispatchEvent(new Event(EventConstants.LOGIN_SUCCESS))
}else{
userName.text = "";
password.text = "";
Alert.show("Login Failed! Invalid 'User Name' or 'Password'.","Alert")
}
}
private function httpServiceFaultHandler(event:FaultEvent):void{
httpService.removeEventListener(ResultEvent.RESULT, httpServiceResultHandler);
httpService.removeEventListener(FaultEvent.FAULT, httpServiceFaultHandler);
httpService = null;
}
]]>
</mx:Script>
<mx:Panel title="Login Page" width="400" height="300" styleName="loginPanel" verticalAlign="middle" horizontalAlign="center" backgroundImage="assets/images/hello.jpg" backgroundAlpha=".1">
<mx:VBox width="260" height="95" styleName="loginBox" backgroundAlpha=".2">
<mx:HBox width="100%">
<mx:Label width="85" text="User Name" styleName="loginTextStyle"/>
<mx:TextInput width="150" id="userName"/>
</mx:HBox>
<mx:HBox width="100%">
<mx:Label width="85" text="Password" styleName="loginTextStyle"/>
<mx:TextInput width="150" id="password" displayAsPassword="true"/>
</mx:HBox>
<mx:HBox width="100%">
<mx:Spacer width="80%"/>
<mx:Button label="Enter" id="submit" click="mouseClickSubmit()"/>
</mx:HBox>
</mx:VBox>
</mx:Panel>
</mx:VBox>
3/12/2011 2:19:51 AM
in the above login page i tried using both tabindex and tab enabled but non of them is working