5 Replies Latest reply on Sep 4, 2011 1:21 PM by whitefinger

    instantiate a component

    whitefinger

      Ok i have been stuck with a problem for about a week now and it may be that out of desperation i may be going down the wrong path but any way this is what im trying to do!

       

      My web site was built using flash Catalyst which was just amazing and now that im coding it in flash builder im not sure if flash Catalyst made it that easy for me.

       

      anyway most of my pages use a dataprovider and an itemrenderer to display the data on the page and so i have this page that uses a datagroup repeated item that displays 9 items that the user then selects one of the nine items  to get more info about that item, which opens a new page. now the new page didnt have a  dataprovider or itemrenderer and so i get the item selected ID and use this ID for retrieving the right item from the database.

       

      protected function group1_creationCompleteHandler(event:FlexEvent):void
                  {
                      var item:String = ClientProfile1DataListSkin1RepeatedItemSkin.ClientsId;
                      getClientResult.token = customerService.getClient(item);
                  }

       

      i then was attaching the "{getClientResult.lastResult[0].ClientName}" to the text property of a <s:RichText

       

      now this did work, when the user selected the item they wanted to view it would open the page with the item ID and show all the info for that item, the problem is that when the user goes back to the screen of the 9 items and selects a diffrent item the page loads with the old item info, its all most if as when flash creates a page it just stays that way untill the web site is closed and then opened and then flash has to rebuilder the page again and then depending on the item selected depends on which info is shown in the full item info page! the page is also recreated if the user pushes the refresh button or the F5 key, but i cant expect ther user to do that so i assume im missing something in flash coding.

       

      so then i thought to my self about the arraycollect.refresh function, if i added the customerService.getClient(item); to an array perhaps i could freshes the array on load and then get the new item!

       

      protected function getSlagResult_resultHandler(event:ResultEvent):void
                  {
                      clientArray = event.result as ArrayCollection;
                    
                  }

       

      <fx:Declarations>
              <s:CallResponder id="getClientResult" result="getClientResult_resultHandler(event)"/>
              <customerservice:CustomerService id="customerService" showBusyCursor="true"/>
          </fx:Declarations>

       

      but as before it worked for the first selected item but just keeps showing the first selected item even if other items are selected and i have been using the arraycollection.refresh and delete(arraycollection) but that didnt work

       

      So now im really close to going back to flash Catalyst to see if maybe redesigning the web site may help, but then i had a thought if flash builder wont destroy the page once the user goes back to a different page perhaps after the user selects one of nine items it should instantiate the client full info component and so creating a new instantiate of that page and thus showing a different page each time the user selects an item!

       

      i just need someone to say it sounds possible as i dont want to spend the day doing this unless im barking up the wrong tree? or any idea's would be good

       

      but if it does sound possible could some one direct me to where i might find the code that Flash Catalyst created that opens the page "client full info component "!

       

      Confused yes me too