The forums have permanently moved to This forum will be kept around in read-only mode for archival purposes. To learn how to continue using your existing account on the new forums, check out this thread.

Results 1 to 1 of 1

Thread: AS3 Multiple Drop Targets (Again)

  1. #1

    AS3 Multiple Drop Targets (Again)

    Hi, this question has been asked by someone else using similar code a while ago at but I still can't get it to work, so I have simplified my version and attached the source files. (They are based on a tutorial from here).

    It is a word puzzle where I am having trouble getting a letter that is duplicated to drop onto either position (i.e. in the word "EVE" I can get the first "E" to drop on the first target and the last "E" onto the last target, but I don't know how to get either "E" to fall on either the first or second target).

    Can anyone help out?

    The code:

    HTML Code:
    var startX:Number;
    var startY:Number;
    var counter:Number = 0;
    E.addEventListener(MouseEvent.MOUSE_DOWN, pickup);
    E.addEventListener(MouseEvent.MOUSE_UP, drop);
    V.addEventListener(MouseEvent.MOUSE_DOWN, pickup);
    V.addEventListener(MouseEvent.MOUSE_UP, drop);
    E2.addEventListener(MouseEvent.MOUSE_DOWN, pickup);
    E2.addEventListener(MouseEvent.MOUSE_UP, drop);
    function pickup(event:MouseEvent):void {;
        reply_txt.text = "";;
        startX =;
        startY =;
    function drop(event:MouseEvent):void {;
        var myTargetName:String = "target" +;
        var myTarget:DisplayObject = getChildByName(myTargetName);
        if ( != null && == myTarget){
            reply_txt.text = "Correct!";
  , pickup);
  , drop);
   = false;
   = myTarget.x;
   = myTarget.y;
        } else {
            reply_txt.text = "Try Again!";
   = startX;
   = startY;
        if(counter == 3){
            reply_txt.text = "Finished!";
    E.buttonMode = true;
    V.buttonMode = true;
    E2.buttonMode = true;
    Attached Files Attached Files

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Home About Meet the Moderators Advertise

 Link to Us


Copyright 1999 - 2012