views:

1509

answers:

3

Hey, again.

The stageHeight and stageWidth are read-write properties of the Stage class.

Is there any way to embed the swf so that when you set them to a different value, this is reflected in the HTML page? Possibly without calling a JS function via ExternalInterface to modify the embed's parameters?

The main idea is that I don't know what size my swf will be. I'm loading a video inside it and I want to resize the swf to match the size of the video.

A: 

To my knowledge you can't do that. I can't actually fiddle around with it, 'cause i currently don't have access to flash.

It could work if you would insert the swf into a div, or whatever, that's "too big" for it in the first place, and then just try and resize it. What are you using to embed the swf, the basic thingie offered by the Flash IDE or something else, like swfobject?

I don't know, you might have to actually use ExternalInterface or something like that to get the job done. And if it's not terribly important to work the player into your web layout, i would just implement the whole thing in the flash movie.

JHollanti
+1  A: 

Your definitely going to need to call a JS function, the good news is it's really simple code, something like this:

function resizeIt(height)
{
      document.getElementById("myDiv").height = height;
}

Using SWFObject in this case you can set the width and height to be 100%, so it'll resize with the containing DIV, so you're not modifying the embed paramerters, but just the css.

Tyler Egeto
+1  A: 

We use http://code.google.com/p/swfobject/ which allows for auto resizing in addition to some other nice features.

Ckhrysze