我正试图在Adobe Animate中ping一个网站,我不知道我在哪里混淆了。我现有的代码如下 - 任何帮助都表示赞赏< 3
意味着什么:点击一个实体名称为HotelA的按钮来ping网站 (我已经有了crossdomain xml文件)
谢谢 -Regards,A。
HotelA.addEventListener(MouseEvent.CLICK, doThePing);
var ldr:URLLoader = new URLLoader();
ldr.addEventListener(HTTPStatusEvent.HTTP_STATUS, ldrStatus);
var url:String = "www.google.com.au";
function doThePing():void
{
ldr.load(new URLRequest(url));
}
function ldrStatus(evt:*):void
{
if(evt.status == 200)
{
doRedirect();
}
else
{
// there is an internet connection but the server returns something else (probably something is wrong with the server)
doFailedRedirect();
}
}
function doRedirect():void
{
gotoAndStop(1);
}
function doFailedRedirect():void
{
gotoAndStop(7);
}
错误输入"输出"我看到的是:
ArgumentError: Error #1063: Argument count mismatch on AssignTask_Working_fla::MainTimeline/doThePing(). Expected 0, got 1.
答案 0 :(得分:0)
在事件监听器函数中添加一个输入变量:
...
function doThePing(event:MouseEvent):void
{
ldr.load(new URLRequest(url));
}
...