Thursday, 20 September 2012

Flash coding

Getting started with coding in flash is pretty basic, all you need to know is a few basic codes. As long as you keep practicing with these codings it will come as second nature soon enough.
Here I have been creating buttons that send me to other pages once clicked on with the following codes:

stop();
Btn1.onPress = function()
{
 gotoAndStop(1);
};

Btn2.onPress = function()
{
 gotoAndStop(2);
};

Btn3.onPress = function()
{
 gotoAndStop(3);
};

Btn4.onPress = function()
{
 gotoAndStop(4);
};

This allows me to travel to and from all four pages by clicking the corresponding buttons.

I had to make sure to name every individual button like Btn1 so I could add coding to them.

Each page is on a different frame. The command gotoAndStop(#) was needed to make that button take me to the frame that was in the brackets like gotoAndStop(1) which would take me to frame 1 (or page 1).

the commands had to me between the {} with a ; at the end to make sure that command was for the one button only and it would not carry on the effect through all the pages. Some incorrect codes would send me through all the pages uncontrollably. The ; is there to end the code.

No comments:

Post a Comment