Hi Kiran.
I think you should create a "ModelLocator" singleton class, that gets and
store the xml information. It would be something like this:

public class MyModelLocator
{
      private static var _instance: MyModelLocator;
      private var _data:XMLList;

      public function MyModelLocator() {
            if (_instance != null)
                  trace("Constructor shouldn't be called directly... now
I'll have to kill you")
            _instance = this;
            this.initData();
      }

      private function initData():void {
             //Load data....
      }
      private function onDataLoaded() {
              //Store data
              this._data = [loaded data];
      }

      public static function getInstance():MyModelLocator{
            if (! _instance)
                  _instance = new MyModelLocator();
            return _instance;
      }

      public function get data():XMLList {
            return this._data;
      }
}

In order to get data in each combobox, you would set
dataprovider="{MyModelLocator.getInstance.data}" (if that XMLList already
has the correct structure to be directly used as a dataprovider in the
combobox... otherwise now is the time to change it ;) )
This way:
 - There's only one instance of MyModelLocator at anytime, anywhere.
 - initData is called only once, so the data is retrieved only once.
 - By storing the data within the singleton class, it's available to the
whole application by just importing the class.


Hope it solves your issue.
Best regards
Andrea.




On Tue, Nov 3, 2009 at 5:59 PM, Kiran Kumar Vasireddy
<[email protected]>wrote:

> Hi ,
>
> I am calling httpservice.send() method and getting the data and populating
> it in XMLList . I want this step to be done only once and want to reuse the
> data what ever I got .
> My scenario is like this
>
> 1)Creating Custom combobox component
> 2) Calling send() in the custom component and populating the combobox
>
> I want to create around 5 instances of the above component . But what is
> happening is the send() is getting called again and again . Is there any way
> to restrict this and get the data only once and use it for my 5 instances .
> The problem here is If I use http send() method when I load the application
> , This works perfect . But we want that to be called only from component and
> want to use the same component again and again.
>
> Thanks for your help
> Kiran
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
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