Here is what I am trying to do and it may make more sense. I have an object
coming back from ColdFusion that contains a list of datasource names. When
reading through the docs I can tell i need an arrayCollection or
XmlLIstCollection to use as the data provider.

I also need to list the field names for each datasource underneath that so
should I just build that completely on the cf side before passing it back or
when the datasource + is clicked retrieve a list of field names.


<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"; layout="absolute"
creationComplete="init()">

    <mx:Script>
        <![CDATA[
            import mx.collections.ArrayCollection;
            import mx.rpc.events.ResultEvent;
            import mx.utils.ObjectUtil;

            [Bindable]
            private var datasources:ArrayCollection;

            public function init():void {
                AdminSrv.login("adminpassword");
                DataSourceSrv.getDataSources();
            }

            public function loginHandler(event:ResultEvent):void{
                trace(event.result);
            }
            public function getDataSourcesHandler(event:ResultEvent):void{
                var ds:Object = event.result;
                trace(ObjectUtil.toString(ds));
            }

        ]]>
    </mx:Script>

    <mx:RemoteObject id="AdminSrv" destination="ColdFusion"
source="cfide.adminapi.administrator">
        <mx:method name="login" result="loginHandler(event)"/>
    </mx:RemoteObject>

    <mx:RemoteObject id="DataSourceSrv" destination="ColdFusion"
source="cfide.adminapi.datasource">
        <mx:method name="getDataSources"
result="getDataSourcesHandler(event)"/>
    </mx:RemoteObject>

    <mx:HDividedBox top="60" right="20" left="20" bottom="20">
        <mx:Tree width="300"  height="100%" dataProvider="{datasources}">
        </mx:Tree>
        <mx:VBox width="100%" height="100%">
        </mx:VBox>
    </mx:HDividedBox>


</mx:Application>

Reply via email to