Need help creating a score system...


hey guys,

 

i have followed onlinehttp://www.flashclassroom.com/docs/documents/444_dragdroptargetsflashcs3.pdftutorial, need score system make when of items dropped onto right location user can click button , move onto next frame, i've tried several things none of them have worked, thought guys might able me...

 

here code:

 

 stop();   //http://passyworldofict.blogspot.co.uk/   var objectoriginalx:number;  var objectoriginaly:number;    germany_mc.buttonmode = true;  germany_mc.addeventlistener(mouseevent.mouse_down, pickupobject);  germany_mc.addeventlistener(mouseevent.mouse_up, dropobject);    france_mc.buttonmode = true;  france_mc.addeventlistener(mouseevent.mouse_down, pickupobject);  france_mc.addeventlistener(mouseevent.mouse_up, dropobject);    italy_mc.buttonmode = true;  italy_mc.addeventlistener(mouseevent.mouse_down, pickupobject);  italy_mc.addeventlistener(mouseevent.mouse_up, dropobject);    uk_mc.buttonmode = true;  uk_mc.addeventlistener(mouseevent.mouse_down, pickupobject);  uk_mc.addeventlistener(mouseevent.mouse_up, dropobject);   function pickupobject(event:mouseevent):void {  event.target.startdrag(true);  event.target.parent.addchild(event.target);  objectoriginalx = event.target.x;  objectoriginaly = event.target.y;  }  function dropobject(event:mouseevent):void {  event.target.stopdrag();  var matchingtargetname:string = "target" + event.target.name;  var matchingtarget:displayobject = getchildbyname(matchingtargetname);  if (event.target.droptarget != null && event.target.droptarget.parent ==  matchingtarget){  event.target.removeeventlistener(mouseevent.mouse_down, pickupobject);  event.target.removeeventlistener(mouseevent.mouse_up, dropobject);  event.target.buttonmode = false;  event.target.x = matchingtarget.x;  event.target.y = matchingtarget.y;  } else {  event.target.x = objectoriginalx;  event.target.y = objectoriginaly;  }  }  

 

any appreciated.

one way keep count increment each time correct drop made,  when count reaches value equates objects being dropped can enable button moving on.

 

var count:int = 0;

 

function dropobject(event:mouseevent):void {

event.target.stopdrag();

var matchingtargetname:string = "target" + event.target.name;

var matchingtarget:displayobject = getchildbyname(matchingtargetname);

if (event.target.droptarget != null && event.target.droptarget.parent ==

matchingtarget){

event.target.removeeventlistener(mouseevent.mouse_down, pickupobject);

event.target.removeeventlistener(mouseevent.mouse_up, dropobject);

event.target.buttonmode = false;

event.target.x = matchingtarget.x;

event.target.y = matchingtarget.y;

 

count++;

 

if(count == 4){

     buttonname.addeventlistener... etc

}

 

} else {

event.target.x = objectoriginalx;

event.target.y = objectoriginaly;

}

}



More discussions in ActionScript 3


adobe

Comments

Popular posts from this blog

Falang and too many redirects - Joomla! Forum - community, help and support

Infinite loop detected in JErrorInfinite loop detected in JError - Joomla! Forum - community, help and support

logged out from joomla! - Joomla! Forum - community, help and support