Drag and drop the gambling problem

Hi guys, im new to Flash and this forum and I really need help because im totally stuck for the last 3 days. I am train to create a simple drag / move the game in flash 5 dragable elements with 5 bins where they are supposed to be kept and bounce back on its initial position if they do not hit the correct location. The problem is that only 2 of the elements work as they are supposed to and also to return to their original position when you press the reset button and the rest 3 don't. The other 3 articles do not yet meet the reset button and that they do not end up where they are supposed to when you drag, they end up all the way to the right (in another tray) what have I done wrong? I can't find any errors in my code either! Ive put matching items for stores etc... so please if someone could just check if they see errors in my code because I think ive gone blind now.

Gor ratt och fel osynliga symbolerna.

right_mc. Visible = false;

wrong_mc. Visible = false;

//

var orig1X:Number = item1_mc.x;

var orig1Y:Number = item1_mc.y;

var orig2X:Number = item2_mc.x;

var orig2Y:Number = item2_mc.y;

var orig3X:Number = item3_mc.x;

var orig3Y:Number = item3_mc.y;

var orig4X:Number = item4_mc.x;

var orig4Y:Number = item4_mc.y;

var orig5X:Number = item5_mc.x;

var orig5Y:Number = item5_mc.y;

item1_mc.addEventListener (MouseEvent.MOUSE_DOWN, dragTheObject);

item1_mc.addEventListener (MouseEvent.MOUSE_UP, item1Release);

item2_mc.addEventListener (MouseEvent.MOUSE_DOWN, dragTheObject);

item2_mc.addEventListener (MouseEvent.MOUSE_UP, item2Release);

item3_mc.addEventListener (MouseEvent.MOUSE_DOWN, dragTheObject);

item3_mc.addEventListener (MouseEvent.MOUSE_UP, item3Release);

item4_mc.addEventListener (MouseEvent.MOUSE_DOWN, dragTheObject);

item4_mc.addEventListener (MouseEvent.MOUSE_UP, item4Release);

item5_mc.addEventListener (MouseEvent.MOUSE_DOWN, dragTheObject);

item5_mc.addEventListener (MouseEvent.MOUSE_UP, item5Release);

skapar en liten hand nar man placerar musen over objects

item1_mc.buttonMode = true;

item2_mc.buttonMode = true;

item3_mc.buttonMode = true;

item4_mc.buttonMode = true;

item5_mc.buttonMode = true;

function dragTheObject(event:MouseEvent):void {}

var item: MovieClip = MovieClip (event.target);

item.startDrag ();

var topPos:uint = this.numChildren - 1;

this.setChildIndex (item, topPos);

};

function item1Release(event:MouseEvent):void {}

var item: MovieClip = MovieClip (event.target);

item.stopDrag ();

If (avc_mc.hitTestPoint (item.x, item.y)) {}

Item.x = avc_mc.x;

Item.y = avc_mc.y;

} else {}

Item.x = orig1X;

Item.y = orig1Y;

}

};

function item2Release(event:MouseEvent):void {}

var item: MovieClip = MovieClip (event.target);

item.stopDrag ();

If (miljo_mc.hitTestPoint (item.x, item.y)) {}

Item.x = miljo_mc.x;

Item.y = miljo_mc.y;

} else {}

Item.x = orig2X;

Item.y = orig2Y;

}

};

function item3Release(event:MouseEvent):void {}

var item: MovieClip = MovieClip (event.target);

item.stopDrag ();

If (trashbag_mc.hitTestPoint (item.x, item.y)) {}

Item.x = trashbag_mc.x;

Item.y = trashbag_mc.y;

} else {}

Item.x = orig3X;

Item.y = orig3Y;

}

};

function item4Release(event:MouseEvent):void {}

var item: MovieClip = MovieClip (event.target);

item.stopDrag ();

If (avs_mc.hitTestPoint (item.x, item.y)) {}

Item.x = avs_mc.x;

Item.y = avs_mc.y;

} else {}

Item.x = orig4X;

Item.y = orig4Y;

}

};  function item5Release(event:MouseEvent):void {}

var item: MovieClip = MovieClip (event.target);

item.stopDrag ();

If (apotek_mc.hitTestPoint (item.x, item.y)) {}

Item.x = apotek_mc.x;

Item.y = apotek_mc.y;

} else {}

Item.x = orig5X;

Item.y = orig5Y;

}

answer_btn.addEventListener (MouseEvent.CLICK, checkAnswers);

reset_btn.addEventListener (MouseEvent.CLICK, reset);

};  function checkAnswers(event:MouseEvent):void {}

If (avc_mc.hitTestPoint (item1_mc.x, item1_mc.y) & &)

miljo_mc.hitTestPoint (item2_mc.x, item2_mc.y) & &

trashbag_mc.hitTestPoint (item3_mc.x, item3_mc.y) & &

avs_mc.hitTestPoint (item4_mc.x, item4_mc.y) & &

{apotek_mc.hitTestPoint (item5_mc.x, item5_mc.y))}

wrong_mc. Visible = false;

right_mc. Visible = true;

} else {}

wrong_mc. Visible = true;

right_mc. Visible = false;

}

} ; int reset(event:MouseEvent):void {}

item1_mc.x = orig1X;

item1_mc.y = orig1Y;

item2_mc.x = orig2X;

item2_mc.y = orig2Y;

item3_mc.x = orig3X;

item3_mc.y = orig3Y;

item4_mc.x = orig4X;

item4_mc.y = orig4Y;

item5_mc.x = orig5X;

item5_mc.y = orig5Y;

right_mc. Visible = false;

wrong_mc. Visible = false;

}

As far as your code goes, as a starting point, you could try is to use event.currentTarget event.target instead.  Event.Target can point to an object that lives inside the object with the assigned listener.  event.currentTarget pointing to the object that has the assigned listener.  See if that helps.

I don't see why your reset function would not put everything back where it came from as long as you change frames and reassign the values origX/Y...

For your own mental health better, you need to be more patient, when the hope of help - especially on a weekend.  One thing that you should avoid is to post a reply to your advertisement, you wonder why no one answers, because it adds the number of responses... 1 with 0 replies showing is what helps people to take notice of an announcement that did not have an answer.

Tags: Adobe Animate

Similar Questions

  • I've lost the ability to copy files on my CD player. When I drag and drop, the only authorized action is 'move' and it does not work.

    I've lost the ability to copy files on my CD player.  When I drag and drop, the only authorized action is 'move' and it does not work.   I tried press and hold the CTRL key while dragging, and when I do that all the other disks show "copy" as the default action, but when I hover over the action CD player available only changes to 'pass '.   I ran the Microsoft Troubleshooting tool for CD/DVD players and he said that the media were not writable, but there is a blank CD in the drive.  Any ideas on how to solve this problem?

    Thanks, but the cd/dvd drive works well - I can burn a cd with windows media player for example.  the problem is that I can't copy files to it.   I can play CDs (haven't checked the DVD).  I can not do and could do before, is doing drag and drop files on it.  The only authorized action is "move".   This happens even when I click CTRL + do drag.   I can copy it to any other player, but the CD player, and when I hover over the "exemplary" drive CD goes to 'move '.

    have you tried using a different suite of cd/dvd burning?

    Imageburn is free and easy to use: http://download.imgburn.com/SetupImgBurn_2.5.7.0.exe

    There may be something to play with your access keys if you have a (ie., wirekeys)

  • Why creates shortcuts for Moving files when drag and drop the folder or file in another folder?

    I am using Windows XP SP3, just before I drag and drop the file into another folder in my windows explore. Suddenly, he is creating shortcuts for moving file. I'm not able to move the file by drag / move the mouse, it is possible that by cutting and Paste(Ctrl+X) using the keyboard. Why?

    Maybe your 'Alt' key is stuck.
    See exchanging the keyboard with another makes all the difference.

    HTH,
    JW

  • Drag and drop the game - add your comments

    Hello

    I created drag and drop the game:

    If the player, drag the object to the correct target - snapping to the target, else it returns to the original location.

    My question:

    I want to add sound (such as feedback) when hanging to the right target.

    What should I write in the code?

    Help, please

    Thank you (-):

    (I added the code and the printscreen)

    star.addEventListener (MouseEvent.MOUSE_DOWN, fl_ClickToDrag);

    function fl_ClickToDrag(event:MouseEvent):void

    {

    star.startDrag ();

    }

    stage.addEventListener (MouseEvent.MOUSE_UP, fl_ReleaseToDrop);

    function fl_ReleaseToDrop(event:MouseEvent):void

    {

    If (star.hitTestPoint (targetstar.x, targetstar.y))

    {

    Star.x = targetstar.x;

    Star.y = targetstar.y;

    }

    else {}

    Star.x = 692;

    Star.y = 232;

    }

    star.stopDrag ();

    }

    square.addEventListener (MouseEvent.MOUSE_DOWN, fl_ClickToDrag_2);

    function fl_ClickToDrag_2(event:MouseEvent):void

    {

    square.startDrag ();

    }

    stage.addEventListener (MouseEvent.MOUSE_UP, fl_ReleaseToDrop_2);

    function fl_ReleaseToDrop_2(event:MouseEvent):void

    {

    If (square.hitTestPoint (targetsquare.x, targetsquare.y))

    {

    Square.x = targetsquare.x;

    Square.y = targetsquare.y;

    }

    else {}

    Square.x = 122;

    Square.y = 266;

    }

    square.stopDrag ();

    }

    create your sound (using the new construction), then apply the play() method to make the sound when your hitTestPoint is real.

  • codesnippent createjs equivalent of flash as3 drag and drop the code snippet

    AS3 deafult code snippent for drag and drop

    circle.addEventListener (MouseEvent.MOUSE_DOWN, fl_ClickToDrag_3);

    function fl_ClickToDrag_3(event:MouseEvent):void

    {

    circle.startDrag ();

    }

    stage.addEventListener (MouseEvent.MOUSE_UP, fl_ReleaseToDrop_3);

    function fl_ReleaseToDrop_3(event:MouseEvent):void

    {

    circle.stopDrag ();

    }

    I just tried to convert this code createjs. but my code does not

    / * js

    var t1 = this;

    {circle.addEventListener ('mousedown', function (e)}

    {stage.addEventListener ('stagemousemove', function (e)}

    T1.x = stage.mouseX;

    T2.y = stage.mouseY;

    });

    {stage.addEventListener ('stagemouseup', function (e)}

    e.target.removeAllEventListeners ();

    });

    });

    */

    are you trying to drag and drop the circle?  If so,.

    var tl = this;

    tl.circle.addEventListener ("mousedown", downF)

    function downF (e) {}

    stage.addEventListener ('stagemousemove', moveF);

    stage.addEventListener ('stagemouseup', upF);

    };

    function upF (e) {}

    stage.removeAllEventListeners ();

    }

    function moveF (e) {}

    TL. Circle.x = stage.mouseX;

    TL. Circle.y = stage.mouseY;

    }

  • [Request] Drag and drop the problem

    Untitled2.png

    Hello everyone, I am a new Member here, and I just installed Adobe Flash Professional CS6 on my computer. I want a simple quiz with drag and drop a feature inside. I want to drag the squares marked a (Square_1) since the first position with 'STAR' in the white square (Target_1), I already dropped the script, but whenever I leave A square on the white square (Target_1), it does not precisely on the white square (Target_1). I use this script to drag and drop with the target job:

    var startX:Number;
    var startY:Number;
    
    Square_1.addEventListener(MouseEvent.MOUSE_DOWN, pickMe);
    Square_1.addEventListener(MouseEvent.MOUSE_UP, dropMe);
    
    function pickMe(event:MouseEvent):void {
        event.target.startDrag(true);
        startX = event.target.x;
        startY = event.target.y;
    }
    function dropMe(event:MouseEvent):void {
        event.target.stopDrag();
        var myTargetName:String = "target" + event.target.name;
        var myTarget:DisplayObject = getChildByName(myTargetName);
        if (event.target.dropTarget != null && event.target.dropTarget.parent == Target_1){
            event.target.removeEventListener(MouseEvent.MOUSE_DOWN, pickMe);
            event.target.removeEventListener(MouseEvent.MOUSE_UP, dropMe);
            event.target.buttonMode = false;
            event.target.x = Target_1.x;
            event.target.y = Target_1.y;
    
        } else {
            event.target.x = startX;
            event.target.y = startY;
        }
    
    }
    
    

    Any help would be appreciated. Thank you.

    If has and that white square was all colon reg, in their centers, or both upper-left you wouldn't have a problem.  as it is with the white square with upper left reg and has with dot central reg, you can use:

    event.target.x = Target_1.x+Target_1.width/2;
            event.target.y = Target_1.y+Target_1.height/2;

    but it would be better to use reg consistent throughout your application.

  • I would like to be able to drag and drop the names of folders to categorize.

    With Thunderbird, folders currently appear in the order they are created. I'd like to be able to drag and drop to a new location so my frequently used address is near the beginning and those less-used at the end. Tyty

    No problem. Add on even made records and accounts.

  • Drag and drop the thumbnails on the desktop (Acrobat XI Mac)

    Acrobat 9 Pro, I'm able to drag one or a group of thumbnails on the desktop, where it would create a pdf file "Untitled extract Pages.pdf" with these pages to the desired location. I could then easily rename the newly created document as I wanted. It's a one-step drag-and-drop.

    Step 1: Drag the pages to the desired location

    Step 2: Rename the resulting file.

    But in Acrobat Pro XI, when I try to drag the photos on the desk, I see the folder in that I want the file to go is highlighted by the drag icon, but nothing fell. Instead I have to:

    Step 1: extract the pages you want

    Step 2: click OK in the extract dialog box

    Step 3: Command-Shift-S to save the file under...

    Step 4: Find the folder which I want to save the file

    Step 5: File name

    Step 6: Click on save

    Is it possible to get the procedure more simple that worked so well in Acrobat 9?

    I am on OS 10.11.6

    Hello

    I want to mention that in Acrobat XI, there was a problem with the feature you mentioned (on Mac) and has been corrected in Acrobat DC.

  • Drag and drop the library not workingf

    I placed a number of graphics (.ai .ps, .eps, .pdf etc.) in a CC library. When Im in InDesgn I can see the items in the library, but when I try to drag and drop them on an open page, I get a message saying "the file does not exist or the file may be in use by another application."

    I've restarted the computer and only Indesign open so that the files are not in use.  The library icons next to the items. I can double click and use goods have been placed in InDesign, but the files in photoshop or Illustrator won't drag-and - drop or double click for use in InDesign.

    Is this to say that I cannot use InDesign created elements of library in InDesign and photoshop only elements in Photoshop etc. ?

    Carl

    I have the same problem

    I repeatedly appealed to tech support, but they couldn't help

    I solved the problem in this way:

    1. launch InDesign

    2 - Open a new document

    3 to drag and drop objects from the library CC

    4. I read the error message :-((()

    5. I swear :-)

    6. close InDesign

    7 - Repeat the pp. 1-3

    7A - if this does not work, I have to open Illustrator object and drag-and - drop library in Illustrator. And then I repeat s. 1-3

  • Drag and drop the blocks slide the whole project

    Hello

    my project structure looks like this more or less:

    (1) ' normal glide. "

    (2) a slide with drag and drop tasks

    (3) sliding normal. "

    (4) Quiz random Question pool slides

    (5) ' normal glide. "

    What is the problem? When the quiz is finished and you click on view or try again button, drag and drop (No. 2) then appear it works correctly as long as the blade drag-and - déposer is removed. What is the problem?

    BTW. Could you suggest me how to randomize the slides in question with regard to the manufacture of new parts inside to open a project? In other words, I need allow the user to get a new set of random questions after you click try again. I don't want him to get the same as it had previously.

    See you soon

    It is only possible to get a new set of questions at random, if the course is raised.

    Regarding your first question: is slide it drop & set up as a question? If it is included in the Quiz, this is the normal behavior of recovery and review both will get back to the D & D slide.

  • Drag and drop the interactive report

    HY!

    For an interactive report, I would like to implement and drag to order lines.

    It's a request complex abandoned behind the report (joints, ect.)

    I need an element hidden like this

    apex_item.hidden(1, rowid) AS Sort
    

    The problem is, that rowid is not here (ORA-00918: column ambiguously defined).

    Because of this article, I'm sure that the joints in my query are problems

    ORA-00918: column ambiguously defined

    But I need the rowid for the sorting process.

    How to implement Drag and Drop, I learned from here:

    Read the Article - Drag & amp; amp; Drop the rows in a table

    Does anyone know of a workaround?

    Thanks for your help!

    ILB.

    Hello

    You can do also, update for example the primary key.

    In the table of the witch you have the column where you store the sort order?

    Use this table for example name as apex_item.hidden (3, ENDGUELTIGEWARTELISTESORT.rowid)

    Kind regards

    Jari

  • Drag and drop the multipul opportunities

    I had this idea to do an activity for fractions using drag and drop with interaction, and even though I know that it is possible to go, it'll take awhile, especially if I'm going to several questions in the same vein.  I hope there is an easier way to do what I think...

    So here is my idea.  I have a picture of a pizza on the screen (cut into 8 sections) established and little gray so they drop targets.  I also have the targets of all 8 drag slices around the screen so that users can drag the pizza (each slice corresponds to the full pizza and will be recognized by their corresponding section).  anyway... that part is fine.  The problem comes when the question is "drag slices on the pizza to create 5/8.  Now, there are a LOT of possibilities for this... and I can configure each of these possibilities in the window 'Good answers' - but as you can imagine, that would take forever!  Is it possible that I can configure the drop than the 1 article area, and still have the slices of pizza to fall into the correct zones (if we don't get slices placed in odd places) so that I can use the function 'account' to specify how many constitute a correct answer?  OR if anyone has any other ideas, I'm willing to try anything to avoid having to take account of all possible combinations for the correct answers.

    Thank you!

    Wanda

    Oh my god!!! I thought about it!  This is my first time using variables, but I created a variable called pizzacounter and set it to 1.  Then I put the advanced actions that whenever a slice of pizza dropped it would add 1 to the varriable of pizza.  Then I added a "check" button, and put in the statement conditional action advanced to check if it the pizzacounter is equal to 5, and then he would show that he is STRAIGHT!  Wow - this will make my life so much easier!

  • Drag and drop the values

    HI - is it possible to drag and drop from one object to the other values?

    I am trying to create a planner of degree two page for students of my institution.  The first page will be of the degree requirements. The second page will be a blank template for several semesters courses planning... like a big grid. See below:

    First page

    Requirements
    CourseDo?

    English 1

    2 English
    Math 1
    Math 2

    Page two

    Fall 2009spring 2010
    .
    .
    .
    .
    .
    .

    I'd like the students to be able to click on a course and drag in the first half, they want to take it.

    Are there other ways to solve this problem? Could I set up on the first page a logic to determine what the requirements are again... then have an army of drop-down lists on the second page that contain values of other requirements?

    Thank you

    No, it is not possible to drag - move in a PDF form.

    The model is suitable for a question-and-answer format by which you use check boxes, drop-down lists, radio buttons, etc. for data capture. In your case, you could do data capture on page 1 and link responses to the calendar on page two.

    Steve

  • I want out emails in folders of ordinary files, but when I drag-and-drop, the "modification date" gets changed. How I can still see the date?

    To archive my e-mail files until I decided to switch to Thunderbird, I create regular folders in windows and drag and drop emails to outlook express in the appropriate folders. The "update" column displays the original date of the email... which is what I want to do with Thunderbird. In my view, that he treats it as a new file created today... that is not good for my archiving system of these professional work files that I need to find often in approximate date.

    I understand the forum that it is by default in Thunderbird. There is an add-on that can do what I'm doing?

    Thank you in advance,
    Netwon

    I think the reason what OE is the original date because each message is stored in a single file, while TB stores all messages in a folder in a file, an mbox file. Thus, when you save a message as a single eml file, its 'modification date' corresponds to the eml file date was written in the mbox file.

    You can find the ImportExportTools add-on useful because it allows you to add the date of the e-mail eml file name when enamel is exported ("Save selected messages" of the message right-click menu).

  • Cannot drag and drop the eamils in Hotmail.

    Hello

    I opened Hotmail today but cannot drag and drop emails as usual. I am still able to open and read them, but I cannot move them to other folders unless I have use the checkboxes and ' move to ' drop-down menu.

    Hotmail is truncated normally works with Internet Explorer, so it must be a matter of Hotmail. I tried to delete the cache and cookies of Hotmail (as least I think they were witnesses of Hotmail).

    Any help would be greatly appreciated!

    It seems to work in Firefox. I think it was on the side of Microsoft.

Maybe you are looking for

  • problem with my mac pro book and the appstore

    I have a problem with my Mac Book Pro (2.53 ghz processor intel core duo / 0sx 10.6.8) and the app store: My apps no longer works after upgrade on the app store... Help :-(

  • coffee spilled on a macbook: how to save files with critical and time sensitive information

    Daughter just spilled coffee on his macbook pro with the basic files needed for papers and research in a week.  How can she recover the files needed to access and use the work by the end of the term.

  • Satellite L755 - 1 CD: Realtek card wireless off using LINUX

    Hi allI have a Toshiba L755 - 1 CD Windows 7, with a Dual Boot Linux. Since yesterday, without explanation, my card (Realtek RTL8188CE) WiFi is disabled at startup. When I boot on windows, it is shown as enabled (in the network adapters Control Panel

  • Delete my old address and phone number of the computer.

    I use a DELL XPS that has loaded Windows XP operating systems. When we first bought this computer, we lived in a State different, different home address and telephone number. But we moved to the sunny New Mexico. Now, whenever I fill out a form, my '

  • Computer technicians HP snoop?

    I send you my HP computer in for repair of the screen and I'm worried that the technitian can see my personal files and the information store, sign in. HP has a polocy that prohibits the option of espionage in the customer drives? This is just a fix