views:

151

answers:

2

Hello everybody,

I have a problem positioning a Flash element inside a div tag. The problem is, that the flash element is changing it's size based on the user input. I need a way how I can dynamically get the actual size of the flash element, and to change the behavior of the div element the flash is integrated in. actually I want to place it in the middle of the div.

right now I gave the flash element width and height of 100% but that way I can not center the element inside the div...

Any solution? I might need javascript right? Im a newby in javascript!

Maechi

A: 

If there's no interaction needed with surroundings of flash, you could include transparent 100% wide and 100% height flash and resize and position moviechild in it through flashvars

Adam Kiss
A: 

if you have:

<div id="container">
 <object id="#flash">...</object>
</div>

you can try this css:

#container {
  width: <larger or equeals than max flash width>px;
}
#flash {
  margin: 0 auto;
}
mathroc
hi mathronc, I try to implement what you suggested. The <larger or equeals than max flash width>px gives me a error in the css file... how can I hand over margin: 0 auto; by flashvars? Thanks Markus
Markus
you should replace <larger or equals than max flash width> with an integer which is "larger or equals than max flash width", eg if your flash max width is 200px, the 2nd line of the css file might read:` width: 200px`
mathroc
what I need is a dynamic action so that the user input in the swf file (which can have a effect on its size) resuts in a change in the css definition...
Markus
I don't have a swf which size change to test that, but you don't have to change the css definition, it should be centered whatever the width of you swf is?or maybe I misunderstand and what you want is essentially to know how to resize your swf?in that case that might be something like (in flash):`getUrl('javascript:document.getElementById ("#flash_id").width = '+width+'px');`but I really have no knowledge about flash and there is certainly a better way to do this.
mathroc