I was just experimenting with using the 'for' loop to add them dynamically just to see how it's done. I'm pulling the number of colorpickers needed from an XML file, and I need them to run a function to color specific items from that XML file.
Sherm --- In flexcoders@yahoogroups.com, "Amy" <[EMAIL PROTECTED]> wrote: > > > Setting the id like that won't let you reference it later by ID. > Also, you're trying to use the MXML way of assigning event listeners > in AS. Try something like this > > private var cp:Array=new Array(); > for (i=0;i<5;i++){ > ssPicker = new ColorPicker(); > cp.push(ssPicker); > //you'll need to look at event.currentTarget to see which picker it > is > ssPicker.addEventListener("open", yourFunction); > } > > You may find that you're better off using a data source that a List > control is bound to for this. When the color pickers change the data > source, the descriptBoxes, which would be itemRenderers for some > other list based control, can automatically pick up the change. > > HTH; > > Amy >