Halp!: Placing Flash on top of a Unity web player

I had this idea of a trick for integrating Unity (web) with a Flash-based GUI. The main concept was to put the SWF in front of the Unity game kinda like this:

Yeah kinda like this
I have  the theory that the SWF movie will “cancel” the mouse events in Unity, just like Flash, when you place a MovieClip in front of a button, disabling the events for that button. But obviously I had to load a Flash movie of the same size of the Unity game to make it unplayable (like a selection screen or pause menu), to deal with that I could unload the SWF or call another with a smaller size (like a score displayer.. or something that Unity could not do with the fanciness of Flash)

Since I’m not very experienced in HTML/JavaScript/CSS I searched for ideas on the web.

My first try was using the <div> tag. Within the tag I could set the z-index of the Flash HTML container the Unity game would be in the main HTML, and then load the HTML containing Flash. I used z-index, to force the Flash container to be infront of the main page.

My next try was loading Flash and Unity into separate IFrames, and forcing each IFrame to have a specific z-index so I could be sure both of them having a strict order, but Unity was still on top.

Using separate iFramesThat yellow label’s actually from Flash, and should not be  cropped

Other try was a trick used by some annoying flash banners (those ones that pop out in front of the main content), the example I found was using FlashObject (yeah when it was called like that). The result was not succcessful.

annoying ad techniqueSame problem

I tested it in Firefox, Opera, Chrome and IE.
Technically everything went well about placing “my Flash” over the main HTML (the “Unity container”). If you take a closer look at the second image in this post, the SWF is in front of the red background (HTML Unity container) BUT the Unity game keeps being at the top… and I don’t know what else to do, I see that as some kind of “bug” on graphics processing (I don’t even know what I’m talking about). So… if someone has some idea about a workaround or something for placing Flash on top of Unity content please let me know 🙂

I’ll upload my source files soon (so you can have  a look).


Update: Seems like someone had this problem too and no solution was found (except the one sayin “don’t place stuff on top of plugin rects” but that’s not quite a solution) :\ http://forum.unity3d.com/viewtopic.php?t=9989

8 thoughts on “Halp!: Placing Flash on top of a Unity web player

  1. This probably doesn’t work for the same reason Stage3D in flash player 11 can’t have anything on top of it.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s