Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

One button, different link at different frames?

New Here ,
Feb 23, 2014 Feb 23, 2014

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");

}

TOPICS
ActionScript
341
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Feb 24, 2014 Feb 24, 2014

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Feb 24, 2014 Feb 24, 2014
LATEST

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines