So if i got it right, you want a custom ComboBox on several screens
and the only thing that is going to change is the dataProvider, right?

I would do the following:

1. In your custom ComboBox declare a variable like this:

private var _myDataProvider : Array; //or ArrayCollection, as you prefer

2. Create a getter and setter methods

[Bindable]
public function get myDataProvider() : Array 
{
return _myDataProvider;
}

public function set myDataProvider(dp : Array) : void
{
_myDataProvider = dp;
 this.dataProvider = myDataProvider;
}

3. In the application where you want to include the custom ComboBox,
pass the dataProvider you want to use, like this:

<custom:CustomComboBox myDataProvider="{DataProviderYouWantToUse}"/>

or

var myCustomCB : CustomComboBox
myCustomCB.myDataProvider = DataProviderYouWantToUse



Please consider that "DataProviderYouWantToUse" is the array (or
arrayCollection) that you want to use as dataProvider for your
ComboBox. When setting the myDataProvider, the setter will be called
and the dataProvider will be updated.

Hope this helps you out

--- In flexcoders@yahoogroups.com, "Roscoe P Coltrane"
<[EMAIL PROTECTED]> wrote:
>
> Using Flex 2 - 
> I have extended ComboBox in an AS3 class. My plan is to use it a lot 
> in several places and just programatically change the dataProvider in 
> each of the places. It works as expected the first time I use it in a 
> generated screen. Later I remove the screen, then still later I 
> recreate the screen containing the combobox. This time the 
> dataProvider still gets updated, but now no data is visible in the 
> dropdown on the screen - it appears empty. I figure it needs to be 
> rebound to the screen somehow, since I have verified I have data. 
> However, I cannot figure out how to bind the instance of the combobox, 
> and / or exactly what else in it besides the dataProvider, in such a 
> way that the screen gets updated.
> Could someone give me some pointers, or at least some idea of what I 
> am doing wrong?
> Thanks,
> Roscoe
>


Reply via email to