Skip to main content
Participant
May 27, 2008
Answered

help with flash as2 hyperlink button

  • May 27, 2008
  • 3 replies
  • 1537 views
hi, this should be very easy to do but i can't accomplish it with my current file. i can link from as1 or as3 but for some reason, this as2 will not let me link. please help! it's too complicated to explain in text the problem here so please download my flash file and see what i'm trying to do. don't worry, no viruses!

this is created on a mac and compressed. view my flash file here: http://www.nafline.com/prototype/dev/header_white3.fla.zip [about 13mb, sorry, don't know why it's so big even though i deleted all unnecessary stuff]

in my file, you'll see there are 2 buttons, 1 has a link using on (release). i want to be able to link them. if you try testing out the swf movie, the link doesn't work. i tried on (click) and mouseEvent and none work. =((

thanks for the help!!!
This topic has been closed for replies.
Correct answer Julianne_Nguyen
thank you so much Ned. i didn't know adding the linkage and the identifier causes the AS not to work. dumb of me.

i thought the linkage/identifer were required in order to call the AS but I guess they're not. i removed them in the button property and added the AS in the actions layer on the mainMovie and it works great! it's live on nafline.com.

thanks again Ned!

3 replies

Ned Murphy
Legend
May 28, 2008
You're welcome Julianne.

The linkage/identifier things are used when you want to dynamically load objects while the file is running.

The linkage identifier comes into play with attachMovie and stuff like that.

The class name is another story. It involves using external files to define objects that you call in... objects that might well be suited for use in other applications--saving you from reinventing the same wheel all the time. IF you ever get involved with AS3, it is more prominently emphasized.
Ned Murphy
Legend
May 27, 2008
Hi Julianne,

After the weight loss program, I was more willing to take a look. I do not understand the science of the problem, so I can only speculate.

You have assigned a linkage for the button, where the class and identifier are the same--that might be a problem (?). But anyways, since the button is fixed to the stage, there is no need to assign a linkage for it, so I removed that entirely and it plays okay with the code you have.

As an alternative, that also works, in case you want to keep those linkages for some reason (?)... and as a better alternative since assigning button actions to the button is frowned on, though I still do it out of habit myself, you can remove that code from the button and create an actions layer in the mainMovie timeline where you place the following code:

viewCart.onRelease = function(){
getURL("https://www.cartmanager.net/cgi-bin/cart.cgi?ViewCart=parkingID", "_self");
}

Doing this helps keep otherwise hidden code out in the timeline where it's easier to find.

AS3 did away with the ability to attach code to objects, so it's probably better to adjust to the timeline version for consistency if you plan to bounce between versions.
Julianne_NguyenAuthorCorrect answer
Participant
May 27, 2008
thank you so much Ned. i didn't know adding the linkage and the identifier causes the AS not to work. dumb of me.

i thought the linkage/identifer were required in order to call the AS but I guess they're not. i removed them in the button property and added the AS in the actions layer on the mainMovie and it works great! it's live on nafline.com.

thanks again Ned!
Ned Murphy
Legend
May 27, 2008
You're right, 13MB is big. Have you tried using Save & Compact. Deleting things from the file doesn't remove them from the file's memory, Save & Compact does.

Could you show the code for the buttons? There's a chance no further looking will be necessary.
Participant
May 27, 2008
wow Ned, the save and compact reduced it down to 512k and compressing it becomes about 150k!!! thx, i learned something new today.

i attach 3 different codes that I tried and none seem to work...and i seriously don't know why!
http://www.nafline.com/prototype/dev/header_white3.fla.zip [about 150kb]