Use addEventListener() for registering an event handler:
myLabel.addEventListener(MouseEvent.CLICK,
myFunction);You should take time to read about event handling in Flex/AS3 as
it's a basic and very important concept!
On Thu, Sep 25, 2008 at 4:33 PM, Ramsey, Robert L
<[EMAIL PROTECTED]>wrote:
> Hi,
>
>
>
> I am working on a scheduling application and need some help working with
> dynamically created clickable objects. I've been using linkbuttons, but
> anything that is clickable will work.
>
>
>
> I have an array that may contain 0-N items, where N can be any number. If
> N>0, I need to create clickable linkbuttons that call a function. What I'm
> doing is something like this:
>
>
>
> *for* *each* (*var* conflict:String *in* conflictArray)
>
> {
>
> *var* myLabel:LinkButton = *new* LinkButton;
>
> myLabel.label = conflict;
>
> myLabel.y = myy;
>
>
>
> myy += 20;
>
>
> Application.application.conflictsPanel.addChild(myLabel);
>
>
>
> }
>
>
>
> What I need to do is have each linkbutton call a function when it is
> clicked and pass two variables to that function. What I'd like to be able
> to do is something like this:
>
>
>
> myLabel.onClick(myFunction(label, label.length);
>
>
>
> Is there an easy way to do this or a different clickable control I should
> be using?
>
>
>
> Thanks,
>
>
>
> Bob
>
>
>
--
Haykel Ben Jemia
Allmas
Web & RIA Development
http://www.allmas-tn.com