Thanks Juan... That was so useful.
Cheers
On Wed, Sep 17, 2008 at 6:40 PM, Juan Pablo Califano <
[EMAIL PROTECTED]> wrote:
> Hi, the problem is that by the time the event fires and your inline
> function
> is called, R1 points to the last object created in the loop.
>
> However, an event object
AIL PROTECTED]> wrote:
From: Omar Fouad <[EMAIL PROTECTED]>
Subject: [Flashcoders] Adding Listeners in a loop
To: "Flash Coders List"
Date: Wednesday, September 17, 2008, 5:47 PM
Hi,
I got this loop that creates some MovieClips one under another.
for (var i:uint = 0; i < data.
Hi, the problem is that by the time the event fires and your inline function
is called, R1 points to the last object created in the loop.
However, an event object is passed to the handler function. The target
property of that object cointains a reference to the object that fired it,
so you can do
; i++) {
fn(i);
}
--- On Wed, 9/17/08, Omar Fouad <[EMAIL PROTECTED]> wrote:
From: Omar Fouad <[EMAIL PROTECTED]>
Subject: [Flashcoders] Adding Listeners in a loop
To: "Flash Coders List"
Date: Wednesday, September 17, 2008, 5:47 PM
Hi,
I got this loop that creates some Mov
Hi,
I got this loop that creates some MovieClips one under another.
for (var i:uint = 0; i < data.length; i++) {
var R1:ResultLink = new ResultLink(data[i].CompanyName,
data[i].CompanyId); //
R1.addEventListener(MouseEvent.CLICK, function():void
{trace(R1.Label)});
BlackBox.addChild(R1)
5 matches
Mail list logo