jah
jah

Reputation: 23

How to get the size of a dynamically loaded swf with javascript?

I want to get the dimensions of a dynamically loaded flash object and resize a DIV accordingly to it. I can't use a server side language to do it.

I've tried searching about loading and reading the header portion of a SWF file to get it's dimensions with javascript but came up empty.

Is this remotely possible/feasible?

Thanks in advance, J

Upvotes: 2

Views: 1204

Answers (1)

Andy Li
Andy Li

Reputation: 6023

As stated in the discussion here, you need to create another swf (call it A) that loads the swf you want to embed (call it B), and read the dimension of B using A's Loader's contentLoaderInfo to get the width and height of B. Finally tell the value to JS using A's ExternalInterface.

Upvotes: 2

Related Questions