Labels

Monday, February 7, 2011

Flash Button navigation url

1. Draw a circle and convert it into button symbol ( right click circle-->convert symbol)
2. Give an instance name for the button from properties panel.
3. Double click on button object, you reach the new work area of button object
4. Look at the Timeline below, you see four options Up-Over-Down-Hit.
5. Up is already slected, press F6 in Over (copying the previous frame) and change the object colour from tools.
6. Repeat the above step for Down-Hit if required.
7. Click on Scene1 on top left corner to come back to original workspace.
8. Add a new layer above layer1, name it actions.
9. Press F9 on actions layer to take to the coding area.
10.

mcbutton.addEventListener(MouseEvent.CLICK, mouseoverHandler);
function mouseoverHandler(evnt:MouseEvent):void
{
   
 var targetURL:URLRequest=new URLRequest("http://www.google.com/");
    navigateToURL(targetURL);
}

11. copy the above code to the coding area. Change mcbutton to your button instance name. mouseoverHandler is the name of the function name, which can be changed according to user interest.
Each function is unique, so remeber to provide unique names for all functions used in a program. Also replace the google URL to the one you require.
12. Now check the flash using Ctrl+E.
Mouse UP

Muse OVER   

1 comment: