Skip to main content
Known Participant
September 22, 2011
Answered

AS2 Clicktag and Rollover questions

  • September 22, 2011
  • 2 replies
  • 7787 views

I'm creating a banner ad for Yahoo.com and am running into a conflict with the Rollover replay and Clicktag. Both are buttons on separate layers with the ClickTag on top. If the Clicktag button is on, the rollover (replay) button is ignored.

I'm wondering what changes I need to make, but I need to keep the AS2 out of the Clicktag button. Also, if I rollover and out quickly, the animation replays, when it should stop. Thanks for any help. I've attached my .fla CS4 for analyzing.

Yahoo specs of note:

  • Animation can begin again on mouse over, but must stop immediately on mouse off.
  • When building flash creative, please note that the expression box must be checked and the URL should say clickTag.

If you would like to see the CS4 file, which may explain a lot more, please visit this link.

http://board.flashkit.com/board/showthread.php?p=4291469#post4291469

Thanks again!

Rollover/replay AS2 code

on (rollOver) {

    this.play(2)

}

on (rollOut) {

    this.gotoAndStop(33)

}

Clicktag

on (release) {

getURL(clickTag, "_blank");

}

This topic has been closed for replies.
Correct answer kglad

both buttons are attached to a timeline.  is that the timeline that you want to play(2) and gotoAndStop(33)?

if yes, use the code i suggested.  if no, explain the relationship between the timeline that contains your code and the one you want to play(2).

2 replies

Participant
September 23, 2011

Hello LuisRM & kglad,

Any luck yet? I'm having the same problem but I must use the code bellow for the clickTAG. The ad server that I'm dealing with states the code must not be altered for it to work. Would using the solution above affect the outcome by assigning instances to the buttons? Sorry for any unintentional Flash/AS ignorance. Thanks.

on (release) {

    if (clickTAG.substr(0,5)=="http:") {

        getURL (clickTAG, "_blank");

        }

}

kglad
Community Expert
Community Expert
September 23, 2011

no.

kglad
Community Expert
Community Expert
September 22, 2011

remove all code from objects.  give both objects instance names (eg, clickTag_btn and replay_btn).  you can then use:

clickTag_btn.onRelease=function(){

getURL(clickTag,"_blank");

}

clickTag_btn.onRollOver=function(){

this._parent.play(2);

}

clickTag_btn.onRollOut=function(){

this._parent.gotoAndStop(33);

}

LuisRMAuthor
Known Participant
September 23, 2011

Thanks for the quick response. So here is exactly what I did.

  • Removed the codes from both button objects.
  • Renamed both button objects (clickTag_btn and replay_btn).
  • Removed Var loop code from Actions layer frame 1
  • Added following code to Actions layer, frame 1.

clickTag_btn.onRelease=function(){

getURL(clickTag,"_blank");

}

replay_btn.onRollOver=function(){

this._parent.play(2);

}

replay_btn.onRollOut=function(){

this._parent.gotoAndStop(33);

}

I changed the second and third actions to replay_btn, rather than clickTag as you noted. Otherwise it wouldn't call for replay, and why rename it correct? In any case, the file doesn't click through or rotate with this code. The hand appears, when I hover over it, but no frame 1 actions are executed.

Layer 1 - Clickthrough button (no code)

Layer 2 - Rotate button (no code)

Layer 3 - Actions (see above for code)

What am I missing that is not allowing both buttons to be recognized by the actionscript? Thanks again!

kglad
Community Expert
kgladCommunity ExpertCorrect answer
Community Expert
September 23, 2011

both buttons are attached to a timeline.  is that the timeline that you want to play(2) and gotoAndStop(33)?

if yes, use the code i suggested.  if no, explain the relationship between the timeline that contains your code and the one you want to play(2).