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

How To Create CheckBox - SwishMax

Learn how to create fully functionable CheckBoxes with swishmax



First Of All

Open swishmax and set the size for the movie, i have used 150 x 100

and frame rate of 25 fps



Step.1

Using the Rectangle tool and whilst holding down the Shift Key drag out a Square approximately 13 pixels wide and 13 pixels high.
by holding down the shift key whilst dragging you will get a uniform shape.
give a solid line colour of #336699 and a linear colour fill of #CCCCCC with the transparency set to 80 to solid #FFFFFF, Name the shape check_box_1 you should have something like fig.1 below.

This is an enlarged view.

Fig.1

Step.2

Now to create the marker, select the text tool and using the webdings font the the letter 'a' in lowercase, this will give you the tick for the box, dont have the webdings font
Download Here
When you have got your tick place it in the middle of check_box_1 and name as tick_1
like in fig.2 below.
This is an enlarged view.
Fig.2


Step.3

Duplicate the two items twice more and place them apart at the side of one another, adding one the the names so you will have tick_2, tick_3 and check_box_2, check_box_3 Untill you have something looking like fig.3 below.
This is an enlarged view
. Fig.3

 

Step.4

Now with all the items selectes group together as a sprite and name the sprite set_1
you should now have all the items you have created inside a sprite called set_1.

 

Step.5

Now to add the code to make the Check boxes work.
Add the following code to the set_1 sprite

Code:

onLoad () {
check1=false;
check2=false;
check3=false;
}
onEnterFrame() {
check_box_1.useHandCursor = false;
check_box_2.useHandCursor = false;
check_box_3.useHandCursor = false;
if(check1==false){
tick_1._visible=false;
info1="Checbox 1 is Unchecked";
}
if(check2==false){
tick_2._visible=false;
info2="Checbox 2 is Unchecked";
}
if(check3==false){
tick_3._visible=false;
info3="Checbox 3 is Unchecked";
}
if(check1==true){
tick_1._visible=true;
info1="Checbox 1 is checked";
}
if(check2==true){
tick_2._visible=true;
info2="Checbox 2 is checked";
}
if(check3==true){
tick_3._visible=true;
info3="Checbox 3 is checked";
}
}

Now Add the following code to check_box_1
Code:

on (press) {
if(check1==false){
check1=true;
}else if(check1==true){
check1=false;
}
}


Now Add the following code to check_box_2
Code:

on (press) {
if(check2==false){
check2=true;
}else if(check2==true){
check2=false;
}
}


Now Add the following code to check_box_3
Code:

on (press) {
if(check3==false){
check3=true;
}else if(check3==true){
check3=false;
}
}

Thats it Now press Ctrl+t to test it working in the player.
Thank You for reading.