Flash: How can I Disable or block all mouse events temporarily for an externally loaded SWF
A common solution to this kind of problem in ActionScript 2 is what is often called a "blocker" clip. Simply create a movieclip that consists of a fully transparent fill. Then you can place this movieclip where ever you want and size it as needed. Finally you assign this clip a dummy mouse event and turn off it's use of the hand cursor - like this:
blocker.onRelease = function() {};
blocker.useHandCursor = false;
As long as this clip is above your loaded content, it will absorb any mouse events.
Jon
.Net, Flash, C developer. I'm interested in: video, audio, compilers, functional programming languages, user interface issues, SQL performance tuning, and concurrency.
Updated on June 04, 2022Comments
-
Jon almost 2 years
I have SWF files that I load into my flash movie and those SWF files sometimes have mouse events that can interfere with dialogs and buttons in my flash movie. I'd like to temporarily disable the loaded SWFs mouse event handlers or block them from having any effects on my flash movie. My flash movie is AS 2.
-
Jon almost 15 yearsI don't have control over the ActionScript of the underlying movie. It does its own thing and I'd like to stop it from doing it.
-
Jon almost 15 yearsI like this idea and I added a movieclip that's above the swf I'm loading but even after every mouse related event I can think of the clip is still catching my onrelease events.
-
Branden Hall almost 15 yearsWell, I'm positive this technique works - I use it all the time! You need to make sure that the movieclip is visible (blocker._visible = true). You may want to add some actual color to the fill to make sure that you are, in fact, above the loaded SWF since it's easy to get the depth wrong with AS2.
-
Jon almost 15 yearsYeah I've used it too. I made my blocker clip contain a large blue rectangle so I'm very certain it's being loaded and at the right width and height. If you're interested the assets that are giving me the biggest headaches are from Print2Flash.