Button Hands on Training Assignment
When you create a button, you will Insert>New Symbol and choose button. As the
book discusses, you must complete all four states: Up,Over,Down, Hit. After the button
is successfully created it is automatically stored in the library. Drag a copy of the
button from the library onto the stage.
Next, you will add another layer for actionscript. See actionscript below.
In this exercise, you will notice a variable created in line 1 "var google_url"
Next, you will notice the "URLRequest" command. This line is where you place your URL.
The third line hold the function "pressthis", you will note the name of the function is also
placed in the last line of the eventlistener.
In the actionscript, bottom line, the name of the button is google
Make sure you type this name in the property inspector. Click on the button
once and make sure the property inspector is open. Type in the name.
var google_url:URLRequest=new
URLRequest("http://www.google.com");
function pressthis(event:MouseEvent):void
{
navigateToURL(google_url,"_blank");
}
google.addEventListener(MouseEvent.CLICK,pressthis);