Skip to main content
GameDev.net gamedev.net
🔒 Locked

[web] AS3: BitmapAsset and click events

Started by Atrix256 Nov 18, 2009 at 6:30 PM 1 replies 1.6k views
Original Post
Atrix256
Atrix256
Does anyone know if a BitmapAsset is incapable of having a MouseEvent.CLICK event listener attached to it? I've tried hooking one up just like i would with a shape and it doesn't seem to work...
    [Embed(source="SoundOn.png")]
    private var ImageSoundOnEmbeded:Class;
    private var ImageSoundOn:BitmapAsset;
....
      ImageSoundOn = new ImageSoundOnEmbeded();
      ImageSoundOn.x = 0;
      ImageSoundOn.y = 343;
      ImageSoundOn.addEventListener(MouseEvent.CLICK,ClickSoundButton);
      addChild(ImageSoundOn);
The image shows up correctly but when i click on it, my function isn't being called (i put a trace in there and tried other code as well to verify that it isn't being called) Any ideas?
esrix
esrix
Bitmaps do not extend the InteractiveObject class, so you can't add mouse events to them.

For example, look at the inheritance for the MovieClip class:
Object > EventDispatcher > DisplayObject > InteractiveObject > DisplayObjectContainer > Sprite > MovieClip

Now, look at the inheritance for the Bitmap class:
Object > EventDispatcher > DIsplayObject > Bitmap
Atrix256
Atrix256
Thanks (:

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.