Skip to main content
New Participant
November 18, 2014
Question

Flash CS6 as3 Navigate to URL stops timeline animation!

  • November 18, 2014
  • 2 replies
  • 580 views

Hello

I'm hoping someone can help me out! I'm quite new to flash but slowly getting the hang of it. I'm trying to make an interactive banner using jpegs converted to buttons etc with type, all animated. I've got separate layers for everything including mask layers and actions. I just want to navigate on a top layer which is invisible to take the user to a new URL. Everything is working great until I put more than one URL link in the code, as soon as I do the whole banner animation stops!!

If someone could suggest a few ideas it would be much appreciated as I'm all out?!

Many thanks,

here's the code:

import flash.events.MouseEvent;

btn1.addEventListener(MouseEvent.CLICK, btn1Click_1);

btn2.addEventListener(MouseEvent.CLICK, btn2Click_2);

function btn1Click_1(event: MouseEvent): void

{

  navigateToURL(new URLRequest("http://www.google.com"), "_self");

}

function btn2Click_2(event:MouseEvent):void

{

  navigateToURL(new URLRequest("http://www.youtube.com"), "_self");

}

addEventListener(MouseEvent.MOUSE_OVER, mo);

function mo (event:MouseEvent):void

{

event.currentTarget.stop();

}

function mo2 (event:MouseEvent):void

{

event.currentTarget.play();

} addEventListener(MouseEvent.MOUSE_OUT, mo2);

This topic has been closed for replies.

2 replies

Inspiring
November 18, 2014

This has nothing to do with the URLs.

by writing:

addEventListener(MouseEvent.MOUSE_OVER, mo);

addEventListener(MouseEvent.MOUSE_OUT, mo2);


without referencing an object you want to target Flash assumes you want to target the object you are placing that code on.

In this case: your main timeline.

addEventListener(...)

//gets interpreted as

this.addEventListener(...)


also: read up on the difference between MOUSE_OVER and ROLL_OVER

Difference between MouseEvent.ROLL_OVER and MouseEvent.MOUSE_OVER in AS3 | AS3 RollOver vs MouseOver | zedia flash blog

SpencedAuthor
New Participant
November 18, 2014

Thanks Ned and moccamaximum for the replies.

The last bit of code does apply to the whole timeline as it stops the animation with a Mouse Over/Roll Over. Taking this away has no effect on the animation in the timeline. The only thing that seems to stop the timeline animation is the second button URL request!

btn2.addEventListener(MouseEvent.CLICK, btn2Click_2);

and:

function btn2Click_2(event:MouseEvent):void

{

  navigateToURL(new URLRequest("http://www.youtube.com"), "_self");

}

Works perfectly without this command. I don't get it!

Ned Murphy
Legend
November 18, 2014

Do you get any error message?

Ned Murphy
Legend
November 18, 2014

Your mouse over listeners appear to be assigned to nothing (aka the main timeline) and they are telling the currentTarget to stop.  I suspect that is what might be causing the problem