Hi all,
I’ve got these functions :
private function onEmptySpaceClicked(e:MouseEvent):void{
var myVar = e.currentTarget.name;
if (e.currentTarget.name == "ES1"){
trace("click on one");
clickPuzzles.click1 = true;
}
if (e.currentTarget.name == "ES2"){
trace("click on two");
clickPuzzles.click2 = true;
}
public function buildIt(e:MouseEvent):void{
if (clickPuzzles.click1){
test.x = e.currentTarget.x;
test.y = e.currentTarget.y;
test.visible = true;
}
}
The builIt function is called by an other class.
Everything is working, but, is it possible to save e.currentTarget.x and y on the “onEmptySpaceClicked” function as a value ?
And then use it in my buildIt function ?
Like :
private function onEmptySpaceClicked(e:MouseEvent):void{
var myVar = e.currentTarget.name;
if (e.currentTarget.name == "ES1"){
trace("click on one");
clickPuzzles.click1 = true
e.currentTarget.x && e.currentTarget.y = valueOfEs1
}
if (e.currentTarget.name == "ES2"){
trace("click on two");
clickPuzzles.click2 = true
e.currentTarget.x && e.currentTarget.y = valueOfEs2
}
public function buildIt(e:MouseEvent):void{
if (clickPuzzles.click1){
test.position = valueOfEs1
test.visible = true;
}
if (clickPuzzles.click2){
test.position = valueOfEs2
test.visible = true;
}
}
It is, of course, not a real code that I used but it is just for showing you the principle.
Thank you very much,