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().

0 thoughts on “Determining the XML class’s settings in ActionScript 3.0

  1. 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?