期待标识符Leftbrace前 [英] Expecting Identifer Before Leftbrace

查看:206
本文介绍了期待标识符Leftbrace前的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

 进口flash.events.MouseEvent;
进口flash.net.URLRequest;
进口flash.net.navigateToURL;

VAR EmailFlashVariable =aa@aa.com;
VAR AdfURLNavigator;
VAR AdfFlashVarsUtil;

mcButton.addEventListener(侦听MouseEvent.MOUSE_UP,的onClick);
函数的onClick(E:的MouseEvent):无效{
AdfURLNavigator.navigateToUrl(AdfFlashVarsUtil.getParameter(clickTAG的)+; cppar = 1&安培; EmailURLVariable =+ EmailFlashVariable);

VAR click_url:字符串= root.loaderInfo.parameters.clickTAG;
如果(click_url){
    navigateToURL(新的URLRequest(click_url),'_blank');
}
 

我已经更新上面的脚本和清除错误信息,但它不会显示在URL中的参数,而不是我得到这个 -

 类型错误:错误#1010:术语是不确定的,没有属性。
在_10792MB_fla :: MainTimeline /的onClick()
 

解决方案

函数的返回值。 像Fygo写道,当你把在AS3函数签名的最后,希望你把函数有没有返回值的类型

由于有问题的函数是一个事件监听器,它应该是无效,意思是没有得到恢复,可以这么说。

让你无论写什么Fygo张贴在第一他的回答一半,或者你写

 函数ADFclicked(事件:MouseEvet):无效
 

请看看在文档

import flash.events.MouseEvent;
import flash.net.URLRequest;
import flash.net.navigateToURL;

var EmailFlashVariable = "aa@aa.com";
var AdfURLNavigator;
var AdfFlashVarsUtil;

mcButton.addEventListener(MouseEvent.MOUSE_UP, onClick);
function onClick(e:MouseEvent):void {
AdfURLNavigator.navigateToUrl(AdfFlashVarsUtil.getParameter("clickTAG") + ";cppar=1&EmailURLVariable=" + EmailFlashVariable);

var click_url:String = root.loaderInfo.parameters.clickTAG;
if(click_url) {
    navigateToURL(new URLRequest(click_url), '_blank');
}

I have updated the script above and that cleared the error messages, but it will not show the parameter in URL instead I got this -

TypeError: Error #1010: A term is undefined and has no properties.
at _10792MB_fla::MainTimeline/onClick()

解决方案

Functions return values. Like Fygo wrote, when you put : at the end of a function signature in AS3, it expects you to put the type of the return value of the function there there.

Given that the function in question is an event listener, it should be void, meaning that "nothing" gets returned, so to speak.

So you either write what Fygo posted in the first half of his answer, or you write

function ADFclicked(event:MouseEvet):void

Please take a look at the Documentation

这篇关于期待标识符Leftbrace前的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆