PDA

View Full Version : Actionscript getURL causes IE6 JavaScript hangup


larsxe
07-01-2007, 11:33 AM
I have a Flash movie whose only task in life is to display a line of text that's passed to the movie as a flashVar. I want to resize the movie dynamically in the browser window so that it only takes up the minimum amount of space necessary to display the text.

I'm trying to accomplish this by setting the movie width and height in the browser to 100%, containing the movie in a DIV, and then calling a JavaScript function from ActionScript that resizes the DIV to whatever width and height the text that was passed to the movie happened to be.

I'm calling the JavaScript function from ActionScript by using:

getURL("javascript:myResizeFunc(" + textWidth + "," + textHeight + ")");

directly in the main timeline.

The problem is, if I have multiple instances of these movies in a page, the first movie's getURL is called fine, but the remaining movies getURL function calls do absolutely nothing. No errors, just... nothing.

So... are there any known issues with getURL under IE6? I have tried using fscommand instead, to no avail.

I am using SwfObject to load the movie, with Flash Player 9.

Are there other techniques available for achieving the desired result (resizing the movie in the browser based on content). For instance, could you tell the Stage to "take up whatever space you need to"?

larsxe
07-02-2007, 12:12 AM
Ok, so I think I know what's the cause of this mess.

It appears there's a general problem calling multiple getURL() in rapid succession with IE, as described here:

http://www.rabidgadfly.com/?p=28
http://www.adobe.com/devnet/flex/articles/analytic_app_05.html

The solution suggested -- to use a custom queuing class -- is not an option for me as the calls are coming from multiple flash movies (and not one single flash movie).

Any suggestions?

As mentioned, all I'm trying to do is resize the Flash movie player space on the web page to the actual width and height of a dynamic text field. If there's any other way around this, please feel free to share your ideas. It seems like there must be an easy solution to this...

larsxe
07-02-2007, 01:40 AM
Ok, if anyone's interested, problem is solved. :)

Instead of using getURL(), I used ExternalInterface.call(). This appears to do something (synchronous calls?) that getURL() didn't get right.

Also, since this is running under ASP.NET, and consequently everything is placed in FORM tags, I had to apply the "form fix" to the SwfObject loader.