user310291
user310291

Reputation: 38180

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

I try to create a tab interface: enter image description here

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);  
      } 
    }       
}

Upvotes: 0

Views: 2643

Answers (3)

goliatone
goliatone

Reputation: 2174

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.

Upvotes: 2

Lars Blåsjö
Lars Blåsjö

Reputation: 6127

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 {

Upvotes: 7

philipp
philipp

Reputation: 16495

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

Upvotes: 2

Related Questions