2

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).

Paolo
  • 704
  • 9
  • 24
  • Take a look [here](http://www.adobe.com/devnet/flash/articles/first_as3_application.html#articlecontentAdobe_codeblock_22). – akmozo Oct 23 '15 at 23:16
  • this should be the convertion: this.btn.addEventListener( MouseEvent.CLICK, function() { navigateToURL(new URLRequest("http://flash.html.it"),"_blank"); }); but how do i write the 'javascript:shrinkSkinOverlayDiv()' part in it? – Paolo Oct 23 '15 at 23:22
  • Take a look on [`navigateToURL()`](http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/net/package.html#navigateToURL()) ... For your case, `javascript:shrinkSkinOverlayDiv()` is your URL, so you can do : `navigateToURL(new URLRequest('javascript:shrinkSkinOverlayDiv()'), '_self');`. – akmozo Oct 24 '15 at 00:05

1 Answers1

1

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");
}
Jason Sturges
  • 15,855
  • 14
  • 59
  • 80