Question

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 client side solution if it is at all possible. If not the server side is .net based.

Was it helpful?

Solution

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

OTHER TIPS

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.

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top