| Home | Register | FAQ | Members List | Search | Today's Posts | Mark Forums Read |
|
|
#1 (permalink) |
|
Registered User
Join Date: Dec 2007
Posts: 6
|
I saw this script here 1. first create the button 2. then rename the button under properties tab of your property box usually located lower part of your screen on a Mac OS. Windows.... been so long i don't even remember. 3. then in the actionscript of the **current frame**, not the button object, you input: function gotoAdobeSite(event:MouseEvent):void { var adobeURL:URLRequest = new URLRequest("Enter your URL here"); navigateToURL(adobeURL); } mybutton.addEventListener(MouseEvent.CLICK, gotoAdobeSite); Where as "gotoAdobesite" is your event function, you can name it anything really instead of "gotoAdobesite", Just have to change them at both instances on the code above. "mybutton" is the the name you assigned to the button in step 2. You can directly create an object when you using navigateToURL functin like this: navigateToURL(new URLRequest("Enter your URL here")); which will replace: var adobeURL:URLRequest = new URLRequest("Enter your URL here"); navigateToURL(adobeURL); What happen if i have 2 more buttons ? I tried to name them but he wond exept this...why ? |
|
|
|
|
|
#2 (permalink) |
|
Senior Member
Join Date: Aug 2006
Location: Belfast
Posts: 784
|
you would create a new variable for the other button. see where 'var adobeURL... etc' is? call the new variable adobeURL2 or something and just repeat code... where did u get this code from? its all over the place! |
|
|
|
#3 (permalink) |
|
Senior Member
Join Date: Aug 2006
Location: Belfast
Posts: 784
|
just copy this.. for every new button, create a new 'var' and a new eventlistener and handler var link:URLRequest = new URLRequest("http://www.designerstalk"); var link2:URLRequest = new URLRequest("http://www.google.com"); button1_mc.addEventListener(MouseEvent.CLICK, onClick):void { navigateToURL(link); } button2_mc.addEventListener(MouseEvent.CLICK, onClick):void { navigateToURL(link2); } button_mc.buttonMode = true button_mc2.buttonMode = true |
|
![]() |