开发者

event listeners and syntax for the actionpanel

I've done most of my code in as3, working from either document class or classes. I've never done action script from within the actions panel (within Flash cs4). My question is do I need to follow the as2 manual in order for majority of code to work ? for example. If I want to do a loop. I can't do a

addEventListener(Event.EnterFrame,loop);

I have to do

varible = onEnterFrame()
{

}

that type of code, I've only seen in AS2. my question is what documents do I read so I know what to use when working from the actions panel.

also would like to start a loop in the actions panel. I've saw it a few time's but I can't think of any resources that demonstrate it at the moment. also, I am using as3

[edit]

If I add the following code inside the Actionscript panel. I get an error

addEventListener(Event.ENTER_FRAME, loop);

public function loop(e:Event):void
{

}

error

1114: The public attribute can only be used inside a package.

If you must know why, I am just curious in case I want to try some simple code out without开发者_C百科 setting up a document class. Thanks


I'm not totally sure this is what you're asking for but:

addEventListener(Event.ENTER_FRAME, loop);

function loop(event:Event):void {
    //whatever code you want to happen each frame
}


If you are using CS4 you should use AS3. So the example you posted would look like:

addEventListener(Event.ENTER_FRAME, loop);

Good luck!

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜