PDA

View Full Version : Expand flash movie via Actionscript



geophurry
June 15th, 2009, 12:06 AM
Wondering if anyone has any suggestions here, I must be missing something obvious...

I'm trying to make a flash movie that expands on rollover, "pushing" down the rest of the HTML page the movie resides in. On rollout, it should go back to it's original size. Ideally, this expansion would be animated, and I could adjust the speed to sync with the JS expansion of the DIV the movie resides in.

For the pushing part, I'm using a javascript call to a scriptaculous method, which works well when triggered through Flash's external interface. Problem is, I can't seem to get the movie itself to resize. I've tried changing the "stage.stageHeight" attribute, to no avail.

Surely there is a way to change a flash movie's height at runtime. But how?

Thanks,

Jeff

.ral:cr
June 15th, 2009, 03:32 AM
with js, you can't change the swf size within the swf
i have a function like this:

function setFlashHeight(divid, newH){
var el = document.getElementById(divid);
if(el.currentStyle) {
//alert("IE");
el.style.height = newH+"px";
}
else {
//alert("FF");
el.style.setProperty("height", (newH+"px"), null);
}
}

geophurry
June 15th, 2009, 10:36 AM
So, you're saying I can't change the size of the swf via AS, only via Javascript? Can't seem to get the script below to work, as it doesn't call the movie out explicitly, I assume it has a lot to do with how you're embedding...

Thought I'd figured out a solution via a transparent background, but no dice (it blocks the HTML underneath.)

Seems like my only option is to change the height of the SWF at runtime as needed... Perhaps you could give me a few more details about how this should work? There's tons of scripts that expand a flash movie dynamically to fit a resized window, so this must be possible.

Thanks,

Jeff

.ral:cr
June 15th, 2009, 01:17 PM
i'm embeding with swfobject and the script works fine. you either missed the swf id somehow, or you're not calling the script. i wanted to say that you can't change the swf height with stage.stageHeight, but you can call this script with externalinterface

check also the swffit

geophurry
June 15th, 2009, 01:43 PM
Thanks, I actually ended up switching to swfobject (was using the AC JS thing flash generates) and that in an of itself seems to have gotten me the effect I'm looking for. Now I just need to make sure it works in IE 7.