0

我收到了一些 Flash (AS3) 横幅来向它们添加 ClickTag 代码,并且由于文档已设置为 AS3,因此不允许将代码添加到项目中!

如果有人可以提供帮助,我需要帮助尽快将以下代码更改为 AS3?

on (release) {
   getURL (_level0.clickTag, "_blank");
}

我无法将文档改回 AS2,因为它们是通过 InDesign 创建的,如果我改回它们,过滤器将不起作用!

谢谢,

托马斯。

4

1 回答 1

4

在 AS3 中,on(event) 工作流程已被事件系统取代;并且 getURL() 被重命名为 navigateToURL() 女巫更清楚该函数的作用。

// 'import' the necessary resources : If you don't do this, you'll have error while compiling.
import flash.events.MouseEvent;
import flash.net.URLRequest;
import flash.net.navigateToURL;

// theBanner is the name of your clickable MovieClip. If you add the code in the MovieClip, use 'this' instead
// this line indicate to call "onClick" if MOUSE_UP occurs on theBanner (ie : the user release the mouse hover the MovieClip
theBanner.addEventListener(MouseEvent.MOUSE_UP, onClick);

// The onClick function, how open the new clickTag URL when called
function onClick(e:MouseEvent):void {
  // get the clickTag URL (root.loaderInfo.parameters.clickTag), and send it to navigateToURL.
  navigateToURL(new URLRequest(root.loaderInfo.parameters.clickTag), '_blank');
}
于 2013-05-22T12:17:27.493 回答