Share Posted September 20, 2012 Hi, is it possible to BlitMask a MovieClip with buttons in it ? it seems to disable all MouseEvents when I apply it Link to comment Share on other sites More sharing options...
Share Posted September 20, 2012 Right, when BlitMask's bitmapMode is on (true), it is simply showing pixels in a BitmapData in place of your actual target, so interactivity is lost. However, if you turn bitmapMode off (false), interactivity is restored but you lose the speed benefits because at that point BlitMask is just acting as a regular rectangular mask. Keep in mind, though, that the BlitMask instance itself does dispatch MouseEvents so you could listen for rollovers, rollouts, clicks, etc. on the whole area. You could figure out if the click happened within the button's bounds, you should be able to figure that out with some extra code that compares the mouse position to the location of the button. Link to comment Share on other sites More sharing options...
Author Share Posted September 20, 2012 Ok, that's perfect, as I didn't want to have to create a new mask to add MouseEvents. Thanks Link to comment Share on other sites More sharing options...
Author Share Posted September 27, 2012 It seems that the MouseEvent is nullified when setting the blitMask.bitmapMode = false; Is there a way of having the Mouse actions working whilst having bitmapMode off ? Here is code. _container has a load of images,buttons and text private var blitMask:BlitMask; private function buildTabs(e:MouseEvent) { blitMask = new BlitMask(_container, 0, 0, 300, 300,false); blitMask.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler); blitMask.bitmapMode = true; } private function mouseDownHandler(event:MouseEvent):void { trace(event); } Link to comment Share on other sites More sharing options...
Share Posted September 27, 2012 If the BlitMask were to intercept MouseEvents like that, it would prevent interactivity with the target. Imagine 2 buttons on top of each other, both with MouseEvent.CLICK event listeners - only the top one would be clickable. See what I mean? So in your case, if you want to get the MOUSE_DOWN events even when bitmapMode is false, just add a listener to your target too. Or put an invisible object above both the BlitMask and your object and attach your MouseEvent handlers to that. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now