dimanche 19 mars 2017

Using stop in action script 3.0 for two objects

I have an instance of Gear and one of bLine. When the Gear gets on the bLine, they both start moving simultaneously. I am trying to stop both of them at one frame, I don't want the objects to go off the stage. Since my gear's move was created through a motion tween and my bLine moves through a function, I am not sure how that can be accomplished.

Code inside of the Gear instance:

var ev2:Event = new Event("transfer");

dispatchEvent(ev2);

Code inside of bLine:

import flash.events.Event;

this.addEventListener(Event.ENTER_FRAME,Move);

function Move(e:Event):void {
this.x=this.x+3;

};

Main timeline:

gear.addEventListener("transfer",transferGear);

function transferGear(e:Event) {
bLine.gotoAndPlay(2);

};

I don't know if there is a way how I could stop the bLine inside of the Gear instance, in order to be able to stop both objects at the same time.

Aucun commentaire:

Enregistrer un commentaire