PDA

View Full Version : flash in an iframe.



Dennis_Gull
04-13-2007, 01:21 AM
Hello, im trying to put a flash object inside an iframe (so its used like a container) But the flash object will only be in the upper left corner if your using Firefox. Both in IE and opera the flash file will go a little to the left and down..

This is how the iframe look like:
<iframe src="<URL here" width="<width here>" height="<height here>" allowtransparency="" scrolling="no" align="middle" frameborder="0"></iframe>';

I also tried to give it an align="left" but it didnt work.
Everything is done dynamically and im using the flash objects width and height as the height and width of the iframe.. So the flash object and iframe have the same size.


The only thing thats in the container is the flash object..

BLiZZaRD
04-13-2007, 03:08 PM
You will need CSS to center or otherwise align the iframe and it's contents.

I can't remember off the top of my head the exact coding for this, but if you search this forum in the CSS section you will find the answer.

Do you really need the iframe though?

Dennis_Gull
04-14-2007, 12:28 PM
It was just an idea, im programming an affiliate section at the moment and thought it would be easier to use iframe but if its wont work I will keep it as it is now.

jscheuer1
04-14-2007, 01:19 PM
This can work but the flash object needs to be on a page in the iframe. Once you have that, you can kill all margin and padding for that page, set that page's width to that of the object (this goes in the head of that page):

<style type="text/css">
body {
margin:0;
padding:0;
width:<width of flash object>px;
}
</style>

I haven't tested this exact method but, it can be done and this should be a good generic way to do it. Let me know if you have any problems with it.

Dennis_Gull
04-15-2007, 02:15 PM
It works in all browsers now, I used the code you posted but it wasnt necessary to use the width though:
<style type="text/css">
body {
margin:0;
padding:0;
}
</style>

Btw this isnt really related to the main question but when I use an iframe the SuckerTree Vertical Menu (http://www.dynamicdrive.com/style/csslibrary/item/suckertree-menu-vertical/) will pop out one pixel when its over the iframe but only when im in Firefox, look here (http://img295.imageshack.us/img295/7459/iframeku8.gif) any idea why?

Moglizorz
04-21-2007, 11:02 AM
How about (for the original question), make a new html page to put inside the iframe, with the html as:

<html><body topmargin="0" leftmargin="0" rightmargin="0" bottommargin="0"><embed src="flash_source.swf" height="100&#37;" width="100%"></embed></body></html>
Where 'flash_source.swf' is the flash file. They just put that page into the IFrame.