Reply LinkBack Thread Tools Search this Thread
Old 20-12-2007, 09:47   #1 (permalink)
ehud36new
Registered User
 
Join Date: Dec 2007
Posts: 6
if i have 2 buttons ? more then 1....



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 ?
  Reply With Quote
Old 20-12-2007, 09:54   #2 (permalink)
forbes
Senior Member
 
forbes's Avatar
 
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!
  Reply With Quote
Old 20-12-2007, 10:02   #3 (permalink)
forbes
Senior Member
 
forbes's Avatar
 
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
  Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search


Contact Us - Web Design Forums - Archive - Top
Search Engine Optimization by vBSEO 3.0.0 RC8