Hi there i am making a little game app via adobe flash and acs3 . I want to start the app then a movie clip appears , then i have some series of buttons on stage from which the user must select the one to match the object on screen with the button . Every time the user hits a button click from the buttons placed on stage, the object should change based on the correct (add 10 the score) or wrong(do not count) button click from user. So basically , i think a way to match the object spawned on screen with the buttons on screen ,is to take their x and y and if they match add on score and move on. ,Any ideas on how to make an object appear on specific x ,y on stage and then wait for the user to click and based on their x and y match or wrong? I can provide more info if someone has questions.
var score=1;
var gameTime:Number =20;
//stop();
var myTimer:Timer = new Timer(1000);
myTimer.addEventListener(TimerEvent.TIMER, createNote);
myTimer.start();
function createNote(evt:TimerEvent):void{
var aNote:NoteF = new NoteF();
aNote.y = 400;
//aNote.y = (Math.floor(Math.random() *100) + 400 );
aNote.x = ( Math.floor(Math.random() *150) + 100 );
aNote.addEventListener(MouseEvent.MOUSE_DOWN,hitme);
gameTime--;
addChildAt(aNote, 0);
txtTime.text = gameTime.toString();
if (gameTime <= 0){
gotoAndStop(6);
myTimer.stop();
aNote.stop();
}
}
function hitme(event:MouseEvent){
var ms:NoteF = new NoteF();
ms.x = event.stageX;
ms.y = event.stageY;
//addChildAt(ms, 0);
txtScore.text = Score++;
event.target.parent.removeChild(event.target);
}
//set the array and fill in the notes for treble
var TrebleArray:Array=["C1","D1","E1","F1","G1","A","B","C","D","E","F","G","A1","B1"];
//then set up the listener for the button
PiannoKeys.addEventListener(MouseEvent.CLICK ,piannokeys);
function piannokeys(myEvent:MouseEvent){
btnC.visible=false;
btnD.visible=false;
btnE.visible=false;
btnF.visible=false;
btnG.visible=false;
btnA.visible=false;
btnB.visible=false;
}
btnC.addEventListener(MouseEvent.CLICK,btnc);
stop();
//now the function called by the function listener
function btnc(myEvent:MouseEvent){
var currentNote:Number=Math.round(Math.random()*(TrebleArray.length-1));
//currentNote++;
txtFeedback.text=TrebleArray[currentNote];
}