![]() |
|
|
|||||||
![]() |
|
|
Thread Tools | Rate Thread |
|
|
PM User | #1 |
|
New to the CF scene Join Date: Sep 2006
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
![]() |
Iframe HTML to overlay Flash object ..
Any tips for getting an iframe to overlay Flash content (swf embedded in a div container)?
Here is an example of overlay iframe script .. Code:
<iframe id="myIframe" name="myIframe" height="200" width="200" border="0" scrolling="no" marginwidth="0" marginheight="0" frameborder="1" vspace="0" hspace="0" style="position: absolute; left: 50px; top: 100px; display: ; z-index: 99; " > </iframe> But when the iframe is positioned to overlay the Flash content .. (a) in IE browser, the iframe correctly overlays the Flash content (b) in Firefox 1.5 the iframe is hidden behind the Flash content. Changing z-index does not seem to help. ... The main problem to solve is getting consistency of "iframe above Flash" across browsers. There is another problem .. in IE the iframe goes out of focus and is hidden when the Flash content is clicked; but I guess that can be solved with some extra javascript to bring iframe back into focus. |
|
|
|
|
|
PM User | #2 |
|
New to the CF scene Join Date: Sep 2006
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
![]() |
Resolved ..
Resolved after trial and error ..
(a) place Flash embed script in <div> container (I use SWFObject.js) (b) add wmode=transparent to Flash embed script (c) set <div id="flashcontent"> container with z-index:-1; (d) set <body> tag with style .. position:relative;left:0px;top:0px;z-index:0; (otherwise Firefox does not accept negative z-index) (e) set floating iframe in container with z-index: 99; (f) use CSS to position flashcontent and htmlcontent containers. ... Now the iframe htmlcontent should be positioned above Flash. |
|
|
|
|
|
PM User | #5 |
|
Senior Coder ![]() Join Date: Sep 2005
Location: Sydney, Australia
Posts: 2,276
Thanks: 0
Thanked 23 Times in 22 Posts
![]() |
Note that iframes ALWAYS appear in front in Opera 8.5 and earlier so that with those browsers you don't get a choice to put anything in front of an iframe (fortunately you want the iframe in front anyway).
__________________
Stephen Helping others to solve their computer problem at http://www.felgall.com/ Web related ebooks and software - http://members.felgall.com/ Focus on Javascript - http://javascript.about.com/ |
|
|
|
|
|
PM User | #6 |
|
New to the CF scene Join Date: Feb 2007
Posts: 5
Thanks: 1
Thanked 0 Times in 0 Posts
![]() |
i have everything working, but still cant get the iframe to stay in focus. the frame will remain in focus when clicking on the main html pages content, but if a user clicks on the flash object that is supposed to remain in the background, it causes the iframe to go to blur.
i've tried the below script which gives the above effect... <script> document.getElementById('myIframe').focus(); document.getElementById('flashcontent').blur(); </script> anyone have a snipplet that will make an iframe remain in focus at all times? chris<pixelmonkey>
Last edited by pixelmonkey; 02-26-2007 at 12:33 AM.. |
|
|
|
|
|
PM User | #8 |
|
New to the CF scene Join Date: Feb 2007
Posts: 5
Thanks: 1
Thanked 0 Times in 0 Posts
![]() |
so with wmode added to the object before altering the code for the SWFObject.js , it will look like the below...
Code:
<object width="550" height="400">
<param name="wmode" value="transparent">
<param name="movie" value="somefilename.swf">
<embed src="somefilename.swf" width="550" height="400" wmode="transparent">
</embed>
</object>
Code:
<script type="text/javascript">
// <![CDATA[
var so = new SWFObject("somefilename.swf", "sotester", "900", "520", "8", "Black");
so.addVariable("flashVarText", "this is passed in via FlashVars for example only"); // this line is optional, but this example uses the variable and displays this text inside the flash movie
so.write("flashcontent");
// ]]>
</script>
thoughts? chris<pixelmonkey>
|
|
|
|
|
|
PM User | #9 | |
|
New to the CF scene Join Date: Jan 2008
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
![]() |
Quote:
|
|
|
|
|
|
|
PM User | #10 |
|
New to the CF scene Join Date: May 2008
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
![]() |
Hi,
I went through and the examples and I am able to display the iframe and swf file, but I am unable to overlay the swf over iframe. Here is a sample of my HTML. Thanks, Alan <body> <form id="form1" runat="server"> <script type="text/javascript" src="swfobject.js"></script> <div id="flashcontent" > </div> <script type="text/javascript"> var so = new SWFObject("movie.swf", "mymovie", "400", "200", "8", "#336699"); so.write("flashcontent"); so.addParam("wmode", "transparent"); </script> <iframe id="frame1" name="frame1" runat="server" border="0" scrolling="no" marginwidth="0" marginheight="0" frameborder="1" vspace="0" hspace="0" style="position: absolute; left: 9px; top: 100px; z-index: 99; width: 554px; height: 475px;" > </iframe> </form> </body> |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Rate This Thread | |
|
|