Friday, August 26, 2011

[AS3] error 1013 The private attribute may be used only on class property definitions.

#1013 The private attribute may be used only on class property definitions.

In my case, make the private function() contain into the package tag is a solution:
確保把 private的function 包在package裡。

Bad code:

package
{
import flash.display.*;
import flash.events.*;

public class zoom_picture2 extends MovieClip
{
private var itemOfNumber:Number = 10;
right_btn.addEventListener(MouseEvent.CLICK,onClickbtn);
}
}
private function onClickbtnl(e:MouseEvent):void {
trace("hallo");
}


Good code:

package
{
import flash.display.*;
import flash.events.*;

public class zoom_picture2 extends MovieClip
{
private var itemOfNumber:Number = 10;
right_btn.addEventListener(MouseEvent.CLICK,onClickbtn);
}
private function onClickbtnl(e:MouseEvent):void {
trace("hallo");
}
}

No comments :

Post a Comment