本文介绍了如何使用的getURL在类(AS3)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我用这个code,但之后公布时,我自动打开我的文件2的互联网浏览器(www.example.com)是开放
I use this code but after publish when I open my file automatically 2 internet browser (www.example.com) are open
package {
import flash.display.SimpleButton;
import flash.display.Sprite;
import flash.net.navigateToURL;
import flash.net.URLRequest;
import flash.net.URLRequestMethod;
import flash.net.URLVariables;
public class bAEForm extends SimpleButton {
public function bAEForm() {
var url:String = "http://www.google.com";
var request:URLRequest = new URLRequest(url);
var variables:URLVariables = new URLVariables();
variables.exampleSessionId = new Date().getTime();
variables.exampleUserLabel = "guest";
request.data = variables;
request.method = URLRequestMethod.POST;
navigateToURL(request);
}
}
}
我想,当我preSS我的按钮,然后跨浏览器(www.example.com)应该是开放
I want, when I press my button then inter browser (www.example.com) should be open
推荐答案
如果要导航到URL的按钮被点击您code时,应该是这样的:
if you want to navigate to URL when the button is clicked you code should something like this:
package {
import flash.display.SimpleButton;
import flash.display.Sprite;
import flash.net.navigateToURL;
import flash.net.URLRequest;
import flash.net.URLRequestMethod;
import flash.net.URLVariables;
import flash.events.MouseEvent;
public class bAEForm extends SimpleButton {
public function bAEForm() {
this.addEventListener(MouseEvent.CLICK, clickHandler);
}
private function clickHandler(event:MouseEvent)
{
var url:String = "http://www.google.com";
var request:URLRequest = new URLRequest(url);
var variables:URLVariables = new URLVariables();
variables.exampleSessionId = new Date().getTime();
variables.exampleUserLabel = "guest";
request.data = variables;
request.method = URLRequestMethod.POST;
navigateToURL(request);
}
}
}
您不能在构造函数中使用navigateToURL功能
You can't use navigateToURL function in the constructor
这篇关于如何使用的getURL在类(AS3)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!