首先,我想为我糟糕的英语道歉,因为它不是我的母语。
我需要帮助将一段 AS3 脚本转换为 AS2,我知道它有点“你能为我做这个”的问题,但我真的无法解决它。
这是需要转换为 AS2 的一段脚本:
var url:String = "http://media.admeen.com/branding/branding01.swf";
var w:int = 100;
var h:int = 100;
branding_def.addEventListener(MouseEvent.CLICK, onClickHandler);
branding_def.buttonMode = true;
branding_def.useHandCursor = true;
function onClickHandler(event:MouseEvent){
var variables:URLVariables = new URLVariables();
variables.lng = Capabilities.language;
var request:URLRequest = new URLRequest("http://media.admeen.com/branding/forward.php");
request.data = variables;
try {
navigateToURL(request, "_blank");
} catch (e:Error) {
trace("Error: ");
}
}
var loader:Loader = new Loader();
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, success);
if(Security.sandboxType == Security.REMOTE){
var context:LoaderContext = new LoaderContext();
context.securityDomain = SecurityDomain.currentDomain;
loader.load(new URLRequest(url), context);
} else {
loader.load(new URLRequest(url));
}
function success(evt:Event):void{
var branding:MovieClip = MovieClip(evt.target.content);
if (contains(branding_def)) removeChild(branding_def);
var fX = (w/branding.loaderInfo.width);
var fY = (h/branding.loaderInfo.height);
addChild(this.scaleToFit(branding,(branding.width*fX),(branding.height*fY)));
}
function scaleToFit(mc:MovieClip, maxW:int, maxH:int):MovieClip{
maxH = maxH == 0 ? maxW : maxH;
mc.width = maxW;
mc.height = maxH;
mc.scaleX < mc.scaleY ? mc.scaleY = mc.scaleX : mc.scaleX = mc.scaleY;
return mc;
}
我真的希望你能帮我解决这个问题!
亲切的问候