Pilby wrote:

<mx:Button id="btnOK" label="OK" click="btnOKClicked(event, 'hello', 'blue', 'bird');" />
[snip]

Here is an example of me creating the same button, BUT dynamically:

var temp = this.createChild(mx.controls.Button, null, { id:"btnOK" label:"OK" });

Now here is my question. How do I dynamically define a listener for this that allows passing multiple parameters?

Like this:

var temp = this.createChild(mx.controls.Button, null, { id:"btnOK", label:"OK" });
temp.addEventListener("click", mx.utils.Delegate.create(this, clickHandler));


...

function clickHandler(event):Void
{
btnOKClicked(event, 'hello', 'blue', 'bird');
}

So clickHandler is what the MXML compiler automatically generates for you.

Manish




Reply via email to