where to write the code?

Well,
Lets say I have a code like

on (release){
getURL("http://www.enviratest.com", "_blank");
}

These short of codes are generally go inside a button instance or a movieclip instance. Suppose I have a button on stage, whose name is myBtn.If I have to write a code like above then I will select the button, open the actions pannel and write the above code in it.But there is another method of writing the same code too.Which is to write the code in a frame.Now if we take the previous example, then on my stage I have only one button instance at the first frame of my movie.So I will just create another layer, for the sake of clarity.Then I will name the layer as "Actions".Now put a blank keyframe in the Actions layer.Select the Frame and open actions pannel.Now the code I will write for myBtn will look like below code;

myBtn.onRelease=function():Void{
getURL("http://www.enviratest.com", "_blank");
}

Just look at the code.Its doing the same thing in both the cases, but the place and the style of writing has changed.So if you plan to keep all your code in a frame, which is advisable then follow this basic instruction.
Happy flashing 😉

Advertisements

Author: saumya

designer / developer / maker / educator @saumya

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s