开发者

Why can't I stop on frame 1 of Flash timeline?

I try to create a tab interface:

Why can't I stop on frame 1 of Flash timeline?

So on each layer in frame 1 开发者_开发问答I added

this.stop();

but when running it says:

1180: Call to a possibly undefined method addFrameScript.

main.as is currently useless but I can show it in case it would have impact:

package {   
    import flash.display.Sprite;
    import flash.events.*;
    import fl.controls.CheckBox;

    public class main extends Sprite {      

      public function main() {  
        addEventListener( Event.ADDED_TO_STAGE, init );     
      }

      public function init( e:Event ):void {
        removeEventListener( Event.ADDED_TO_STAGE, init );
      }         

      public function hello(target:MouseEvent) {
        trace(target);  
      } 
    }       
}


Since your document class extends Sprite, it doesn't have the stop method. A Sprite doesn't have a timeline or frames. If you want to use a document class and have multiple frames on the main timeline, you should instead extend MovieClip.

So you could change this:

public class main extends Sprite {

... to this:

public class main extends MovieClip {


Don't use FrameScripting and don't use it when you have a document class. Use the Event.ENTER_FRAME to determine where your playhead is. Than you can use FrameLabels to make it flexible to manage. But in the Code above, you are extending Sprite, so there is no play()- and stop()-method which your frames could execute. Also the addFrameScript() method is not available, so try to extend MovieClip, that should work.

Greetings philipp


As it has been already told, you need to extend MovieClip to have a timeline. Also

So on each layer in frame 1 I added

this.stop();

You don't need to add a stop on each layer. If the action is defined in one frame, it will affect all layers on that frame.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜