Skip to main content
Participant
May 6, 2014
Answered

converting from AS 2.0 to 3.0 need help

  • May 6, 2014
  • 3 replies
  • 434 views

I have been using Flash Professional with AS 2.0 to create flash banners using .flv video, the banners have a button layer to click through to a url. That's all I use Flash Professional for, so I know nothing of Actionscript.

Now working with Flash Professional CC which is no longer supporting AS 2.0.

On the Actions line at frame one I have defined Action 1 in AS 2.0 as follows:

button_99.onRelease = function() {

  getURL("http://www.vrcworld.com/common/redirc.ashx?0,0,1226", "_blank");

};

I am getting the following errors when compiling the project:

Scene 1, Layer 'Actions', Frame 1, Line 1, Column 111119: Access of possibly undefined property onRelease through a reference with static type flash.display:SimpleButton.
Scene 1, Layer 'Actions', Frame 1, Line 2, Column 21180: Call to a possibly undefined method getURL.

Can someone help me to get this fixed for AS 3.0?

Thanks a lot,

Pieter

This topic is closed to new replies. Start a new post to keep the conversation going.
Correct answer moccamaximum

put this on the first frame of you fla-file, where your button actually is on stage:

import flash.events.MouseEvent;

import flash.net.URLRequest;

import flash.net.navigateToURL;

button_99.addEventListener(MouseEvent.CLICK, _getURL);

function _getURL(e:MouseEvent):void{

navigateToURL(new URLRequest("http://www.vrcworld.com/common/redirc.ashx?0,0,1226", "_blank"));

}

3 replies

moccamaximumCorrect answer
Inspiring
May 6, 2014

put this on the first frame of you fla-file, where your button actually is on stage:

import flash.events.MouseEvent;

import flash.net.URLRequest;

import flash.net.navigateToURL;

button_99.addEventListener(MouseEvent.CLICK, _getURL);

function _getURL(e:MouseEvent):void{

navigateToURL(new URLRequest("http://www.vrcworld.com/common/redirc.ashx?0,0,1226", "_blank"));

}

Participant
May 6, 2014

thanks a lot.

I tried this, get this compiler error:

Scene 1, Layer 'Actions', Frame 1, Line 10, Column 851137: Incorrect number of arguments.  Expected no more than 1.

applies to this line:

navigateToURL(new URLRequest("http://www.vrcworld.com/common/redirc.ashx?0,0,1226", "_blank"));

Participant
May 6, 2014

got it sorted already with my web and db developer, had to move "_blank") to another level, we used this in AS 2.0 to open link in new browser.

This is the right code now:

navigateToURL(new URLRequest("http://www.vrcworld.com/common/redirc.ashx?0,0,1226"), "_blank");

Thanks a bunch for the quick help, much appreciated.

Pieter