Jbard
10-07-2009, 05:44 AM
Hi
i am trying to make a photo gallery so when people click on a thumbnail it expands to full screen, my problem is i have lots of pictures and i want to determine which one has been clicked. i thought i would use the e.target in a simple if statement like this:
picture.addEventListener(MouseEvent.MOUSE_DOWN, clickedEvent);
picture2.addEventListener(MouseEvent.MOUSE_DOWN, clickedEvent);
function clickedEvent(evt:MouseEvent):void{
if(e.target.name == picture){
trace("picture one is clicked");
}
else if(e.target.name == picture2){
trace("picture two is clicked");
}
}
in this picture one and two are both on the stage with instance names of picture and picture2.
i have no idea why this isn't working, i have used e.target before with no problems.
any help would be great. thanks
i am trying to make a photo gallery so when people click on a thumbnail it expands to full screen, my problem is i have lots of pictures and i want to determine which one has been clicked. i thought i would use the e.target in a simple if statement like this:
picture.addEventListener(MouseEvent.MOUSE_DOWN, clickedEvent);
picture2.addEventListener(MouseEvent.MOUSE_DOWN, clickedEvent);
function clickedEvent(evt:MouseEvent):void{
if(e.target.name == picture){
trace("picture one is clicked");
}
else if(e.target.name == picture2){
trace("picture two is clicked");
}
}
in this picture one and two are both on the stage with instance names of picture and picture2.
i have no idea why this isn't working, i have used e.target before with no problems.
any help would be great. thanks