MouseEvent.CLICK not working? (AS3)

Posted by Jake on Game Development See other posts from Game Development or by Jake
Published on 2013-11-05T19:50:09Z Indexed on 2013/11/05 22:14 UTC
Read the original article Hit count: 191

Filed under:

ok so here's my code in AS3, I'd like to know why when i actually click on the picture, nothing happens. And if any of you have great tutorial of what to learn after classes/functions in AS3, let me know =D :

package 
{
import flash.display.Bitmap;
import flash.display.Sprite;
import flash.display.Shape;
import flash.events.MouseEvent;

public class Main extends Sprite 
{
    [Embed(source="../Pics/Picture.png")]

    private var HeroClass:Class;
    private var hero:Bitmap = new HeroClass();


    public function Main():void 
    {
    addChild(hero);
    hero.addEventListener(MouseEvent.CLICK, onClick);

function onClick(e:MouseEvent):void {
trace("hey");
hero.visible = false;


    }               
}   
}
}

© Game Development or respective owner

Related posts about actionscript-3