views:

359

answers:

3

When you load in an external swf at runtime is there any way to get the background colour of the swf? - That is the stage background colour. The loaded swf is uploaded by users, who may or may not know the correct colour.
I know that normally this is specified in the html code to embed a swf, but if you run a swf in the standalone player it will display the correct colour, so the information should be there somewhere.
What I want to do is to create a background behind the loaded swf, so it will display like intended.

EDIT: I would prefer a clientside solution if it is at all posible. If not the serverside is .net based.

+2  A: 

Hi, You could read the SetBackgroundColor tag in the .swf binary. Don't know how to find it, but this link could help : http://www.adobe.com/devnet/swf/pdf/swf_file_format_spec_v10.pdf

OXMO456
Thank you, if noone comes up with a client side solution I will look into this.
Lillemanden
+1  A: 

If you are running php on your server you can use the PHP SWF Reader to find this, and I'm sure there are similar libraries for other languages.

grapefrukt
Thanks for the link. We are using .net though. And I am looking for a client side solution if it is posible. (I have update the question to reflect this).
Lillemanden
+1  A: 

The most likely place for any type of information about a loaded SWF would be on the contentLoaderInfo property of the Loader. There is no property for the background color. It might be possible to grab the content of the Loader and see if you can extract [SWF] metadata from it, which can include backgroundColor as a property. It might not be available in all cases, though, and there's probably a good chance that the compiler doesn't actually keep this metadata by default to be accessible to ActionScript.

joshtynjala