Forum: Log-In | Register | Contact | Shop


SwishMax Tutorials And Resources
Where Imagination Is The Creation

 


Add


Welcome To Swish-Designs.co.uk Have a Nice Friday

Work-Around for the Tab order in swishmax (tabIndex=)

Learn how to create a tab order Work-around in swishmax for if you desperatly need an order.




First Of All

you will need the newest version of swishmax for this tutorial to work properly.
for the purpose of the tutorial i have used the movie dimensions of 407 x 156 pixels and a frame rate of 25 fps.



Step.1

Using the Rectangle tool drag out a rectangle that covers the canvas size, the colour is not important, but the colout needs to be 100% transparent. Once you have the shape, group it as a button and name the button order.



Step.2

Now create 7 input Text boxes as shown in the demo at the top of the page
name them what you wish but the variable name must be strating from the first box in1
to the last box in7 i have used in as short for input. you can now add the following code to Scene_1

SwishScript:
onLoad () {
order.useHandCursor = false; // hides the default hand cursor.
boxes=7; // sets the amount of input boxes you are using.
count=1; // sets the order count.
start=1; // sets the startting input box.
Selection.setFocus("in1.text"); // sets focus to box 1
}

You should now have something looking like fig.1 below.






Step.3

now you can add the following code to the order button.

SwishScript:
on (keyPress("<Tab>")) {
count=count+++1;
if (count==1) {
Selection.setFocus("in1.text");
} else if (count==2) {
Selection.setFocus("in2.text");
} else if (count==3) {
Selection.setFocus("in3.text");
} else if (count==4) {
Selection.setFocus("in4.text");
} else if (count==5) {
Selection.setFocus("in5.text");
} else if (count==6) {
Selection.setFocus("in6.text");
} else if (count==7) {
Selection.setFocus("in7.text");
}
if (count>boxes) {
count=start;
Selection.setFocus("in1.text");
}
}


Thats All Press Ctrl+T to test what you have in the flash player.
Thank you for reading have fun!..................................