Hi there Everyone! I am new here (this is my first post) and I have just started to learn actionscript. I hope with your help I will be able to develop myself!
I am trying to make an application where I would like to store the first and the second mouse click. Here is my code:
function onClick(e:MouseEvent):void{
if(!firstClick && !secondClick) {
firstClick = true;
firstClicked =e.target as MovieClip;
e.target.gotoAndStop(e.target.name);
clickCheck();
} else if (firstClick && !secondClick) {
secondClick=true;
firstClicked =e.target as MovieClip;
e.target.gotoAndStop(e.target.name);
clickCheck();
} else if (firstClick && secondClick) {
//turn the pages to their back, reset clicks
firstClicked.gotoAndStop(numCard/2+1);
clickCheck();
}
}
function clickCheck():void{
trace(firstClicked, secondClicked);
//trace(secondClick);
//trace(e.target.name);
}
The problem is probably obvious to you all… within the mouseevent the e.target changes on the second click, so it will change the firstClick data as well… I am aware of the problem but I do not really know, how to overcome it, how to solve it…
Please try to help mi if you can.
Thank you in advance!
I am using: AS3 + Flash CS5