Cheers Tom. Thanks sounds right but I'm unsure how to implement it. Previously 
I had it working using 2 array collections which I'd defined within the app. 
I've now commented out these array collections and have instead retrieved them 
via the last result method of a http request but it doesn't seem to be working. 
Here's what I've got so far. You can see where I've commented out my old array 
collections and replaced them with the new dynamic one's just above. I can't 
figure out what I'm doing wrong here:-

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

<mx:Script>
        <![CDATA[
                
          import mx.rpc.events.ResultEvent;
          import mx.collections.*;
      import flash.net.SharedObject;
                                                
      public var profile1NewsAndSportSO:SharedObject;
          
          [Bindable]
          private var profile1NewsAndSportaddLinksFullAC:ArrayCollection;
          
          [Bindable]
          private var profile1NewsAndSportaddLinksAC:ArrayCollection;

          private function newsResultHandler(event:ResultEvent):void
          {
                  
profile1NewsAndSportaddLinksFullAC=newsService.lastResult.newscategory.news as 
ArrayCollection;
                  
profile1NewsAndSportaddLinksAC=newsService.lastResult.newscategory.news as 
ArrayCollection;             
          }
      
//      private var profile1NewsAndSportaddLinksFullAC:ArrayCollection = new 
ArrayCollection([
//        {label:"BBC News"},
//        {label:"ITV"},
//        {label:"Sky News"}
//      ]);
      
//      private var profile1NewsAndSportaddLinksAC:ArrayCollection = new 
ArrayCollection([
//        {label:"BBC News"},
//        {label:"ITV"},
//        {label:"Sky News"}
//      ]);
      
      private function profile1NewsAndSportReset():void{
        resetprofile1NewsAndSportAC();
        profile1NewsAndSportAddLinksTilelist.dataProvider 
          = profile1NewsAndSportaddLinksAC;
        profile1NewsAndSportLinkChoice.dataProvider = new ArrayCollection([]); 
      }
      
      private function resetprofile1NewsAndSportAC():void{
        profile1NewsAndSportaddLinksAC.removeAll();
        for each(var obj:Object in profile1NewsAndSportaddLinksFullAC){
          profile1NewsAndSportaddLinksAC.addItem(obj);
        }
      }
      
      private function initprofile1NewsAndSportSO():void{
        profile1NewsAndSportSO = SharedObject.getLocal("profile1NewsAndSport");
        if(profile1NewsAndSportSO.size > 0){
          if(profile1NewsAndSportSO.data.profile1NewsAndSportaddList){
            if(profile1NewsAndSportSO.data.profile1NewsAndSportaddList != 
"empty"){
              var profile1NewsAndSportaddList:Array = 
profile1NewsAndSportSO.data.profile1NewsAndSportaddList.split(",");
              var profile1NewsAndSporttempAC1:ArrayCollection = new 
ArrayCollection();
              for each(var str:String in profile1NewsAndSportaddList){
                for each(var obj1:Object in profile1NewsAndSportaddLinksAC){
                  if(str == obj1.label){
                    profile1NewsAndSporttempAC1.addItem(obj1);
                    continue;
                  }
                }
              }
              if(profile1NewsAndSporttempAC1.length > 0){
                profile1NewsAndSportAddLinksTilelist.dataProvider = 
profile1NewsAndSporttempAC1;
              }            
            }
          }
          if(profile1NewsAndSportSO.data.profile1NewsAndSportchoiceList){
            var profile1NewsAndSportchoiceList:Array = 
profile1NewsAndSportSO.data.profile1NewsAndSportchoiceList.split(",");
            var profile1NewsAndSporttempAC2:ArrayCollection = new 
ArrayCollection();
            for each(var str2:String in profile1NewsAndSportchoiceList){
              for each(var obj2:Object in profile1NewsAndSportaddLinksAC){
                if(str2 == obj2.label){
                  profile1NewsAndSporttempAC2.addItem(obj2);
                  continue;
                }
              }
            }
            if(profile1NewsAndSporttempAC2.length > 0){
              profile1NewsAndSportLinkChoice.dataProvider = 
profile1NewsAndSporttempAC2;
            }            
          }
        }else{
            profile1NewsAndSportReset();
        }
      }
      private function saveprofile1NewsAndSport(event:MouseEvent):void{
        var profile1NewsAndSportaddList:String = "";
        if(profile1NewsAndSportAddLinksTilelist.dataProvider){
          
if(ArrayCollection(profile1NewsAndSportAddLinksTilelist.dataProvider).length > 
0){
            for each(var obj1:Object in 
              profile1NewsAndSportAddLinksTilelist.dataProvider){
              profile1NewsAndSportaddList += obj1.label + ",";
            }
          }else{
            profile1NewsAndSportaddList = "empty";
          }
        }
        profile1NewsAndSportSO.data.profile1NewsAndSportaddList = 
profile1NewsAndSportaddList; 
        var profile1NewsAndSportchoiceList:String = "";
        for each(var obj2:Object in 
          profile1NewsAndSportLinkChoice.dataProvider){
          profile1NewsAndSportchoiceList += obj2.label + ",";
        }
        profile1NewsAndSportSO.data.profile1NewsAndSportchoiceList = 
profile1NewsAndSportchoiceList;
        profile1NewsAndSportSO.flush();
      }
    ]]>
  </mx:Script>

  <mx:HTTPService id="newsService" resultFormat="object" 
result="newsResultHandler(event)" 
url="http://www.coolvisiontest.com/getnews.php"/>  
       
  <mx:TileList id="profile1NewsAndSportLinkChoice" fontWeight="bold" 
dragEnabled="true" dragMoveEnabled="true" dropEnabled="true" height="129" 
width="650" top="5" left="521" columnCount="5" rowHeight="145" 
columnWidth="125" backgroundColor="#000000" color="#FFFFFF">
    <mx:itemRenderer>
        <mx:Component>
                        <mx:Canvas width="125" height="129" 
backgroundColor="#000000">
                                <mx:Image 
source="{'http://www.coolvisiontest.com/interfaceimages/images/'+ data.icon}" 
top="5" horizontalCenter="0"/>
                                <mx:Label text="{data.label}" bottom="1" 
horizontalCenter="0"/>
                        </mx:Canvas>            
                </mx:Component>
    </mx:itemRenderer>          
  </mx:TileList>
    
  <mx:TileList id="profile1NewsAndSportAddLinksTilelist" fontWeight="bold" 
dragEnabled="true" dragMoveEnabled="true" dropEnabled="true" height="129" 
width="385" top="5" left="128" columnCount="3" rowHeight="145" 
columnWidth="125" backgroundColor="#000000" color="#FFFFFF">
    <mx:itemRenderer>
        <mx:Component>
                        <mx:Canvas width="125" height="129" 
backgroundColor="#000000">
                                <mx:Image 
source="{'http://www.coolvisiontest.com/interfaceimages/images/'+ data.icon}" 
top="5" horizontalCenter="0"/>
                                <mx:Label text="{data.label}" bottom="1" 
horizontalCenter="0"/>
                        </mx:Canvas>            
                </mx:Component>
    </mx:itemRenderer>                  
  </mx:TileList>
          
  <mx:Button click="profile1NewsAndSportReset()" id="reset" label="Reset" y="5" 
height="25" x="5"/>

  <mx:Button click="saveprofile1NewsAndSport(event)" id="save" label="Save 
Changes" x="5" y="38" width="113" height="25.5"/>
        
</mx:WindowedApplication>

--- In [email protected], Tom Chiverton <tom.chiver...@...> wrote:
>
> On Tuesday 23 Mar 2010, James wrote:
> > Can anybody tell me if it is indeed possible to have a dynamically
> > populated array collection stored as a shared object on the user's system
> > and would anyone be willing to help me out if I post my code so far?
> 
> You'll have to explicitly handle the case where your user comes back and has 
> sets
> a: [3,6,8]
> b: [1,2,4]
> but items 8 and 2 are no longer on the server, but it should be easy enough 
> to 
> loop over the SharedObject once the data has been fetched and shuffle the 
> item to the right list if it exists.
> 
> -- 
> Helping to dramatically expedite B2B front-end B2B markets as part of the IT 
> team of the year 2010, '09 and '08
> 
> ****************************************************
> 
> This email is sent for and on behalf of Halliwells LLP.
> 
> Halliwells LLP is a limited liability partnership registered in England and 
> Wales under registered number OC307980 whose registered office address is at 
> Halliwells LLP, 3 Hardman Square, Spinningfields, Manchester, M3 3EB.  A list 
> of members is available for inspection at the registered office together with 
> a list of those non members who are referred to as partners.  We use the word 
> ?partner? to refer to a member of the LLP, or an employee or consultant with 
> equivalent standing and qualifications. Regulated by the Solicitors 
> Regulation Authority.
> 
> CONFIDENTIALITY
> 
> This email is intended only for the use of the addressee named above and may 
> be confidential or legally privileged.  If you are not the addressee you must 
> not read it and must not use any information contained in nor copy it nor 
> inform any person other than Halliwells LLP or the addressee of its existence 
> or contents.  If you have received this email in error please delete it and 
> notify Halliwells LLP IT Department on 0870 365 2500.
> 
> For more information about Halliwells LLP visit www.halliwells.com.
>


Reply via email to