1 Reply Latest reply on Oct 30, 2010 8:06 AM by kglad

    addChild mouseClick

    jagguy999

      If I want to have a mouseEvent and add an image to a sprite  I need to add the image in the class and not after ?

      See where I have used addChild?

       

       

       

      //main.as

       

      myintro=new ClassIntro(IntroCanvas,0,0);

      myintro.addEventListener ("introClicked",intro_Handler);

       

      IntroCanvas.addChild(myintro); //doesnt work but why cant I add this line?~

      IntroCanvas.addChild(myintro); //doesnt work but why cant I add this line?~

      ////ClassIntro

       

       

      private function imageLoaded(event:Event):void

      {

       

       

      var image:Bitmap = new Bitmap(event.target.content.bitmapData);

       

      IntroCanvas.addChild(image);

      IntroCanvas.x = 0;

      IntroCanvas.y = 0;

      IntroCanvas.addEventListener(MouseEvent.CLICK ,doSomething); //for this to work i must add the image to the sprite