mardi 29 septembre 2015

Next button in drag and drop button doesnt function

I am trying to create a drag and drop game. I want to create a next button and it didnt work. If I remove the next button, the drag and drop game works fine but once I add the drag and drop button, then the whole game doesnt function. Here is my code. Can anyone help me?


var objectOriginalX:Number;
var objectOriginalY:Number;

answer.buttonMode = true;
answer.addEventListener(MouseEvent.MOUSE_DOWN, pickObject);
answer.addEventListener(MouseEvent.MOUSE_UP, dropObject);

answer1.buttonMode = true;
answer1.addEventListener(MouseEvent.MOUSE_DOWN, pickObject);
answer1.addEventListener(MouseEvent.MOUSE_UP, dropObject);

answer2.buttonMode = true;
answer2.addEventListener(MouseEvent.MOUSE_DOWN, pickObject);
answer2.addEventListener(MouseEvent.MOUSE_UP, dropObject);

answer3.buttonMode = true;
answer3.addEventListener(MouseEvent.MOUSE_DOWN, pickObject);
answer3.addEventListener(MouseEvent.MOUSE_UP, dropObject);

next_btn.buttonMode = true;
next_btn.addEventListener(MouseEvent.CLICK, next_btn);

next_btn.buttonMode = true;*/

function next_btn(event:MouseEvent):void 

function pickObject(event:MouseEvent):void
  objectOriginalX =;
  objectOriginalY =;

function dropObject (event:MouseEvent):void
  var matchingTargetName:String = + "Target" ;
  var matchingTarget: DisplayObject = getChildByName(matchingTargetName);

  if( != null && == matchingTarget)
  {,pickObject);,dropObject); = false; = matchingTarget.x; = matchingTarget.y;


  else   { = objectOriginalX; = objectOriginalY;

  function next_btn.MovieClip(event:MouseEvent):void 



Aucun commentaire:

Enregistrer un commentaire