Quantcast
Channel: Adobe Community : All Content - Adobe Animate CC - General
Viewing all articles
Browse latest Browse all 13519

Question regarding DispatchEvent. AS3.0

$
0
0

Hello, I'm not too experienced with ActionScript 3.0 but trying look into it somewhat.

Not too long ago I've used the dispatchEvent function inside a class, but I can't seem to get it work anymore and I'm thinking that I'm overlooking something.

 

     This is a MovieClip that is being spawned on the Stage. (Cleaned some unrelevant stuff up).

package  {

 

            import flash.display.MovieClip;

            import flash.display.Stage;

            import flash.events.*;

                              import flash.utils.*;

 

 

          public class Spell1 extends MovieClip {

 

                              public var stageRef:Stage;

 

                    public function Spell1() {

 

 

                              this.stageRef = stageRef;

                              this.x = 43;

                              this.y = 614;

 

                              addEventListener(MouseEvent.CLICK, testingOutStuff);

                    }

                    public function testingOutStuff(e:MouseEvent) {

                              trace("This is tracing.");

                              stageRef.dispatchEvent(new Event("coolDownMaker"));

                              trace(stageRef);

                                        }

                    }

 

          }

 

}

 

 

 

     & The only thing I have in my main Game.as regarding this function is:

 

public function coolDownMaker(stage){

          trace("Y this no work");

 

}

 

 

     I'm probably missing something really dumb here, but it'd help me out so much.


Viewing all articles
Browse latest Browse all 13519

Trending Articles