22
Aug
08

Determining the XML class’s settings in ActionScript 3.0

The following example shows how you can get the XML class’s current settings by calling the static XML.settings() method.

Full code after the jump.

View MXML

<?xml version="1.0" encoding="utf-8"?>
<!-- http://blog.flexexamples.com/2008/08/22/determining-the-xml-classs-settings-in-actionscript-30/ -->
<mx:Application name="XML_settings_test"
        xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white">

    <mx:Script>
        <![CDATA[
            import mx.utils.ObjectUtil;

            private function init():void {
                var obj:Object = XML.settings();
                textArea.text = ObjectUtil.toString(obj);
            }
        ]]>
    </mx:Script>

    <mx:TextArea id="textArea"
            editable="false"
            width="100%"
            height="100%"
            creationComplete="init();" />

    <mx:Label text="{Capabilities.version}" />

</mx:Application>

View source is enabled in the following example.

For more information on the XML class’s settings() method, see the Flex 3 documentation at http://livedocs.adobe.com/flex/3/langref/XML.html#settings().


2 Responses to “Determining the XML class's settings in ActionScript 3.0”


  1. 1 Gareth Arch Aug 25th, 2008 at 6:51 am

    Not sure why, but the example shows “The content requires Adobe Flash Player 9″, but I have Flash 9 (debug) installed currently (From adobe.com “You have version 9,0,115,0 installed”). Is there a more specific requirement for this?

  2. 2 peterd Aug 25th, 2008 at 7:09 am

    Gareth Arch,

    Sorry, I built this example with Flex Builder 3.0.1 and I think the detection is set for Flash Player 9,0,124,0 by default.

    You may need to download the latest version of Flash Player 9 (or Flash Player 10 beta) to see the latest examples: http://www.adobe.com/go/getflashplayer

    Sorry about that,
    Peter

Leave a Reply

This blog is terrible at eating HTML tags. If you plan on posting code/XML, please escape your "<" characters as "&lt;" and your ">" characters as "&gt;".




Badge Farm

  • Powered by Redoable 1.2
  • Cornify
  • Feeds burnt by Feedburner
  • Feed