You made a typo:

container.addEventListener(MouseEvent.CLICK, NavToURL);

must be:

container.addEventListener(MouseEvent.CLICK, navToURL);

//lowercase nav....

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Susan Day
Sent: maandag 1 maart 2010 19:50
To: Flash Coders List
Subject: [Flashcoders] addEventListener Problem

Hi;
I have the following code:

function DisplayPicLoaded(evt:Event):void
{
var container:Sprite = new Sprite();
var myXArray:Array = new Array(10,176,342,508,674,840);
var loaderInfo:LoaderInfo = evt.target as LoaderInfo;
var displayObject:DisplayObject = loaderInfo.content;
displayObject.width = 150;
displayObject.height = 150;
displayObject.x = myXArray[countRounds];
displayObject.y = 10;
displayObject.filters = [createBevel()];
container.addChild(displayObject);
addChild(container);
navPics.push(displayObject);
container.addEventListener(MouseEvent.CLICK, NavToURL);
if (countRounds < 5)
{
countRounds++;
init();
}
}

function navToURL(e:Event):void
{
e.currentTarget.removeEventListener(MouseEvent.CLICK, navToURL);
trace(e.currentTarget);
trace('hi');
}

It throws the following error:

1120: Access to undefined property NavToURL

Why? What do?
TIA,
Susan
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
No virus found in this incoming message.
Checked by AVG - www.avg.com 
Version: 9.0.733 / Virus Database: 271.1.1/2716 - Release Date: 03/01/10
08:34:00

_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to