Development

If you would like to access the property that determines whether the SWF is being run in an externally or in a browser, you can always use the development property. If used in the Flash IDE or the external Flash Player, this property will be set to true. Otherwise it will be set to false.

 

Number of Pages

The property, numPages can be used to out put the total number of pages that are included in the shell.

 

XML Path

Want to change the basePath to the XML directory, try adding the xmlPath attribute to the control.xml. The default is XML/Pages/. The full path to your page xml files would then be your basePath plus your xmlPath, /flash/XML/Pages/. The example below changes the xmlPath to /flash/new/.

<?xml version="1.0" encoding="UTF-8"?>
<LG siteName="Hello World" xmlPath="new/" width="950" height="450" load="all" background="IMG/bg.jpg">
        <throbber color="0xffffff"/>
        <page id="home" title="Home" horizontalCenter="true"/>
</LG>

 

Localization

You can get the current language code by calling the language property in the shell. This will give you the ability to figure out which language is set. This property is a shortcut for the flash.system.Capabilities.langauge property. If you are extending the Shell class, you could add the following:

var lang:String	= language; //will output something like, 'en'

In your pages, you can access the lanuage using the shell property.

var lang:String	= data.shell.language;

 

Multiple Languages

Have a site that supports multiple languages, not a problem. Add the attribute, languages to add support for multiple languages. The languages attribute uses two letter country codes separated by commas. The first code being the default in case an undefined language is being used by the system.

The shell matches the system language (flash.system.Capabilities.language) to a specified language. If matched, will use the xml files inside that language folder. If not found, will go to the default, the first language code listed. You must put the xml files in a directory within the xmlPath, named after the two character code. If the control.xml looks like the code below and the system is set to English (‘en’), then the shell will use the xml files within /flash/XML/Pages/en/. Pages should still be named in the format, idPage.xml. So the home node would be associated with the xml, /flash/XML/Pages/en/homePage.xml.

<?xml version="1.0" encoding="UTF-8"?>
<LG siteName="Hello World" languages="en, es, fr" width="950" height="450" load="all" background="IMG/bg.jpg">
        <throbber color="0xffffff"/>
        <page id="home" title="Home" horizontalCenter="true"/>
</LG>