MouseEvent.CLICK not working? (AS3)
- by Jake
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;
}
}
}
}