Skip to main content
Participant
February 24, 2014
Question

One button, different link at different frames?

  • February 24, 2014
  • 2 replies
  • 364 views

Hello everybody! I'm new to the flash scrip language and dont really know how to code in it. I know basic coding of most language so i'm not a complete stranger to it. I don't intent to learn how to script because i only need help with this small thing so it would be very helpful if you can assist me with it.

I'm creating a banner. Each picture that is shown should have a different link to them.

At the moment i have one big transparent button covering the whole work. When i press it it takes me to a url. However i want it to take me to different urls during different stages om the clip (frame periods). Like from frame 1-100 = "url 1", 101-200 = "url 2" and so on.

How can i code it like i want? It feels like it should use some if then cases or something "If current frame > 100 and current frame < 200 then use this url" but i have no idea how to write that in flash biggrin.gif

The current very simple code look like this.

Code:

Xenonkit_btn.addEventListener(MouseEvent.CLICK, link_1);

function link_1(event:MouseEvent):void

{

    navigateToURL(new URLRequest("http://www.stylingwebben.se/belysning-for-fordon/xenon-belysning1/xenonkit"), "_blank");

}

This topic has been closed for replies.

2 replies

Ned Murphy
Legend
February 24, 2014

One way to do it would be to use a url variable that you reassign at different frames of the timeline...

var urlString:String = "http://www.stylingwebben.se/belysning-for-fordon/xenon-belysning1/xeno nkit";

Xenonkit_btn.addEventListener(MouseEvent.CLICK, link_1);

function link_1(event:MouseEvent):void

{

    navigateToURL(new URLRequest(urlString), "_blank");

}

In frame 100 or wherever you reassign a new value to urlString.

robdillon
Participating Frequently
February 24, 2014

The property currentFrame can be used to do just what you want. Have a look at the examples in the online help.