Topic: config widget with mxml/flex


Back here after a long time. I am trying to build a config widget for my app using flex/mxml in FlashDevelop. While I could build the UI, I am trying to find if the chumby properties are available somehow in the mxml.


Re: config widget with mxml/flex

In AS3, the parameters show up as properties of a LoaderInfo object.

Typically this is available from a MovieClip using the "root" property. From other objects, you'll need to set up some way of getting to "root" by having some MovieClip store it somewhere.

See here for some information that might be helpful.

Re: config widget with mxml/flex

Duane, I checked out that page. I could not find any flex example. My project is a FlashDevelop flex 4 project with only the following code. I'm able to trigger ccHandler function in which I intend to use the root params. However root is null in this function.

<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx=""
               xmlns:mx="library://" creationComplete="ccHandler()">
        <!-- Place non-visual elements (e.g., services, value objects) here -->

        <s:VerticalLayout paddingTop="5" paddingLeft="5"/>


            // Event handler to determine if the selected item is new.
            protected function placesCloseHandler(event:DropDownEvent):void
            protected function ccHandler():void
                ta.text += "ccHandler called";
                for (var i:String in this.root.loaderInfo.parameters)
                   ta.text += ("root.loaderInfo.parameters[\"" + i + "\"] = " + root.loaderInfo.parameters[i]);
    <s:DropDownList id="places" width="250" close="placesCloseHandler(event);"> 
            <fx:Object code="1" label="A"/>
            <fx:Object code="2" label="B"/>
    <s:TextArea id="ta" width="200" text="hello">

The reason for choosing flex is that it has a drop down control and I need it in my config widget!

Re: config widget with mxml/flex

Well, Flex/mxml ultimately compiles to AS3, so everything that works for AS3 should work in Flex.

However, it appears Flex has some additional marshalling code in the Application class.

Try this code.

Re: config widget with mxml/flex

Excellent! Thank you.