Gabriel Meono
Gabriel Meono

Reputation: 1000

AS3: How to stop a movieclip using Class?

I'm doing a space shooter game, and I want my ship to stop shaking when the game is over.

I created a class called Main.as, and I added the ship as child object.

Inside the spaceship_mc movieclip I made a motion tween (which is the shake I want to stop).

*This is the order: spaceship_mc > spaceship_motion (symbol used for motion tween).*

Class struncture

    public class Main extends Sprite {
    private var spaceship:spaceship_mc; ...

          public function Main() {
        placeSpaceship(); ...

Game Over

private function die():void {
            removeEventListener(Event.ENTER_FRAME,onEnterFrm);
            stage.removeEventListener(MouseEvent.CLICK,onMouseCk);

Upvotes: 0

Views: 666

Answers (1)

felipemaia
felipemaia

Reputation: 3571

From your description you just need to call stop() on the ship MovieClip.

spaceship.stop() or spaceship.gotoAndStop(1)

Upvotes: 1

Related Questions