开发者

Why you cannot use onRelease in a class

开发者 https://www.devze.com 2023-04-08 04:46 出处:网络
I am trying set up a simple onRelease function of a button in AS2 within a class file but this is not allowed...

I am trying set up a simple onRelease function of a button in AS2 within a class file but this is not allowed...

public function callFunction(functionString:String) {
    var functionItems:Array = functionString.split(",");
    var functionName = functionItems.shift();
    var functionParams = functionItems;
    EventBroadcaster.getInstance().broadcastEvent(functionName,       
            {param:functionParams});
}

_myButtonBtn.onRelease = function() {
        targetObject[targetFunction]();
    }

public function setCloseAction(targetObject:Object, targetFunction:String) {

    _closeButton.onRelease = func开发者_运维问答tion() {
        targetObject[targetFunction]();
    }



    _closeButton._visible = true;

}

Could someone please tell me why this is and how do I go about setting getting my button click event to work? As mentioned in a previous post I have been tossed into this project and my knowledge of classes are very limited.

When I publish the Swf file I get this Compiling error: This statement is not permitted in a class definition.

Thanks!

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号