your code looks good. any problem?
OK, I am half way there! I got the first button hotspot to link to an outbound site OK (hooray!). Now, I tried two things for the next button hotspot - 1) Tried using the same button as the first one, but giving it a different instance name only (in properties panel) and then calling upon that different instance name.
- That didn't work; it detected a duplicate. 2) tried duplicating the button in the library and re-naming it. Then dragging the new "button" hotspot to the stage, giving it yet another different instance name (in properties inspector) and calling upon the new name from within the script. - Still detecting a duplicate when I go to publish.
I'm getting: Scene 1, Layer 'actions', Frame 500, Line 3 1021: Duplicate function definition function onMouseClick(e:MouseEvent):void
~ Can you please point me in the right direction? Almost got it figured.
onMouseClick appears more than once in your code. use movie explorer to find the duplicate and rename or remove the duplicate.
I need it to appear twice, in fact, I will need it to appear multiple times because there will be multiple buttons which use the onMouseClick command.
What should I do in this case? Should I be citing the script differently?
no you don't. you only need to define a function once. it can be called many times using many different listeners applied to many different objects.
So, for example, what would the script be for the second button in order to link to an outbound site? What would the script be for the 3rd button.
OnMouseClick, I need each different link to link to each different website, follow me?
What should it look like if this is the case??
if you're using movieclip buttons, apply a property to each button to indicate the url and use that in the listener function.
if you're using simple buttons, you'll have to call a different listener function for each button or create an associative array that associates each button's name property with the corresponding url.
if you're using movieclip buttons, apply a property to each button to indicate the url and use that in the listener function
- Can you please give me an example for both: Can you show me the script based upon what I had quoted above so
I can have an "aha" moment? - So I can view how I need to alter it code-wise? I need you to use my script and show me vs. explaining
to me in this manner.
Thank you. And I tried re-naming the property and also duplicating the button in the library with a different name + a different
property name, and I still cannot get it to work properly. - Also, am I making a button mc for every button, or am I recycling
the button mc but changing the script + property name only?
for movieclip buttons:
mc1.urlS = "http://www.adobe.com";
mc2.urlS = "http://www.kglad.com";
for simple buttons (not in the same fla as above code):
Aha, this makes sense to me!
I will work on!
p.s. please mark this thread as answered.