I'm trying to add a number of colorpickers and textareas to my app 
dynamically. Each item needs a separate id, and the colorpickers need 
to call an open() and change() method and pass the textarea id as a 
parameter along with the event. 

I'm a little baffled on how to set the methods, but my ids are 
setting successfully. Here's my code:

public function addPicker():void {
var i:int;             
        for (i = 0; i < 5; i++){                
        var ssPicker:ColorPicker = new ColorPicker();
        var ssTextArea:TextArea = new TextArea();
        var ssVBox:VBox = new VBox(); 
        ssPicker.id = "cp"+i;
        //note: following two lines don't work.
        ssPicker.open = openEvt(event,"descriptBox"+i);
        ssPicker.change = changeColor(event,"descriptBox"+i);
        
        ssTextArea.id = "descriptBox"+i;
        ssTextArea.width = 125;
        ssTextArea.height = 22;
        ssTextArea.text = "Select Color";
        myVBox.addChild(ssVBox);   
             ssVBox.addChild(ssPicker);
             ssVBox.addChild(ssTextArea);
        }
}

Any thoughts on how I can accomplish this?

Reply via email to