Tuesday, October 23, 2007

Flash Questions

1. Can two flash players embedded on the same page talk to each other?

2. Is it typical for flash players to be configured through a separate config file located on the machine?

3. NetStream is responsible for playing

2 comments:

hiddentrak said...

The most common ways of communicating between multiple flash objects on a single page is via ExternalInterface(javascript) or LocalConnection.

ExternalInterface is appealing because it easily facilitates communicating with existing javascript APIs and frameworks.

Jesse said...

When it comes to config files it really depends on the application. I use a xml config file for almost all of my applications. This file is generally stored on the server with the swf in a xml/ or config/ file. I use a Settings Utility to load and parse the files then reference the class for the setting. Here is a link to the class I use (http://flashartofwar.com/?p=21).

The hardest part of getting variables into flash from xml is to get them correctly typed. This utility supports typing them and will convert arrays and leave xml data native.

The other way of configuring a flash app is through the use of FlashVars in the swfObject that embeds it into the page. Here is an example of the swfObject and to access the variables use this code example.

if you use a flashvar called config_xml you can access it inside of the document class like this:

var paramObj:Object = LoaderInfo(this.root.loaderInfo).parameters;

var config_xml:String= paramObj.config_xml;

Hope that helps.