Paolo
Paolo

Reputation: 734

translate an actionscript2 into an actionscript3

i'd like to convert this actionscript 2 instruction:

button_btn.onRelease = function():Void
{
   getURL('javascript:shrinkSkinOverlayDiv()');
}

to an actionscript 3 one.At the moment i'm using adobe flash-cc which doesn't support actionscript 2 actions anymore. Since i'm really noob with flash, i need some help (accepted a work from my boss which i can't even accomplish :P).

Upvotes: 2

Views: 50

Answers (1)

Jason Sturges
Jason Sturges

Reputation: 15955

For your button, use addEventListener() to listen for MouseEvent.CLICK events.

To call a JavaScript function, use ExternalInterface.call().

import flash.events.MouseEvent;
import flash.events.Event;
import flash.external.ExternalInterface;

button_btn.addEventListener(MouseEvent.CLICK, clickHandler);

function clickHandler(event:Event):void {
    ExternalInterface.call("shrinkSkinOverlayDiv");
}

Upvotes: 1

Related Questions