Hi,

In this code, I can see that you are trying to get the data from shared
objects (and u are getting null), but where are you saving it to shared
object?

Regards,
Venkat
www.venkatv.com


On Fri, Feb 27, 2009 at 8:01 AM, mandy <[email protected]> wrote:

>
> Hi,
>
> I have develop an application in which I want to compare 2
> arrayCollection after a refesh. That's why I use share Objects.
> However, the arrayCollection failed to store as shared objects. May
> anyone tell me which aprt went wrong? Below is my code:
>    <mx:Script>
>        <![CDATA[
>        import mx.controls.Alert;
>        import mx.collections.ArrayCollection;
>        import mx.utils.ObjectUtil;
>        import flash.net.SharedObject;
>
>        [Bindable]
>        public var welcomeMessage:String;
>
>        [Bindable]
>        public var localBus:ArrayCollection = new ArrayCollection();
>
>        [Bindable]
>        public var localBus1:ArrayCollection = new ArrayCollection();
>
>       [Bindable]
> public var orgData:ArrayCollection = new ArrayCollection();
>
>        public var lsofeeds:LSOHandler;
>        public var lsosites:LSOHandler;
>        public var lsobus:LSOHandler;
>
>        private var request:URLRequest = new URLRequest("http://
> 192.168.0.1/HISuite/HI_MEC_rssDisplayLatestCloseROUpdates.php");
>        private var loader:URLLoader = new URLLoader();
>        private var XML_busList:XML;
>
>       private function onComplete(event:Event):void
> {
> try{
>        var loader:URLLoader = event.target as URLLoader;
>        if (loader != null)
>        {
>                XML_busList = new XML(loader.data);
>                //trace(XML_busList.toXMLString());
>
>                var a:String = XML_busList.toXMLString();
>
>                               var arr:Array =new Array();
>
>                for each (var prop:XML in XML_busList.row)
>                {
>                        var obj:Object = new Object();
>                arr.push(String(prop.attribute("wipbusno")));
>                                                                obj.Bus =
>  arr.shift();
>
>  orgData.addItem(obj);
>                                                                }
>        }
>        }catch(e:TypeError){
>                Alert.show("Error");
>        }
> }
>
>        public function aNotInB(avArrayA :ArrayCollection,
> avArrayB :ArrayCollection):ArrayCollection
> {
>        var lvArray:ArrayCollection;
>
>        for each( var avObjectA:Object in avArrayA )
>        {
>                if( avArrayB.getItemIndex( avObjectA ) == - 1 )
>                        lvArray.addItem( avObjectA );
>        }
>
>        return lvArray;
>
> }
>
>        private function initApp():void {
>                loader.load(this.request);
>        loader.addEventListener(Event.COMPLETE, onComplete);
>
>        lsobus = new LSOHandler("wipbusno");
>        localBus1 = lsobus.getObjects();
>
>                 trace(localBus1);
>        ocalBus = aNotInB(orgData, localBus1);
>
>        for each( var avObjectA:Object in orgData )
>        {
>                trace("add bus 1");
>                lsobus.addObject(avObjectA);
>        }
>
>
>                }
>
>             ]]>
>    </mx:Script>
>    <mx:DataGrid dataProvider="{localBus1}">
>        <mx:columns>
>            <mx:DataGridColumn headerText="Local Bus 1"
> dataField="Bus"/>
>        </mx:columns>
>    </mx:DataGrid>
>    <mx:DataGrid dataProvider="{orgData}">
>        <mx:columns>
>            <mx:DataGridColumn headerText="Bus" dataField="Bus"/>
>        </mx:columns>
>    </mx:DataGrid>
>    <mx:DataGrid dataProvider="{localBus}">
>        <mx:columns>
>            <mx:DataGridColumn headerText="Local Bus" dataField="Bus"/
> >
>        </mx:columns>
>    </mx:DataGrid>
>
> </mx:Application>
>
> The trace result shows that the shared objects is null and the string
> "add bus 1" doesnt show.I know it may be the problem of how I handle
> the shared object. Can anyone help?
>
> Thanks
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Flex 
India Community" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/flex_india?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to