A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: an educational game - drag and drop

  1. #1
    Join Date
    Oct 2004
    Valencia Spain

    an educational game - drag and drop

    Hi guys. Please forgive my naivity.
    I'm making drag and drop games. In this one you have to drag hamburgers or chips in the right sequence. ie: Hamburger, hambueger, chips . into squares.
    BUT as the hamburger has the same name I have problems when I stop it's dtag properties. ALL of them stop. But if I give them all different names it's a pain as well. I have a hitzone in the square.

    if(this.hitzone4.hitTest(_root.Hamburger)) {
    _root.Hamburger._x = 62;
    _root.Hamburger._y = 60.5;

    Do I give all the hamburgers different names and if so how does the swaure know what is being dropped on it - would I loo through or something.
    Another thing is that I have to specify the coordinates otherwise the hamburger doesn't get left in the centre of the square.

  2. #2
    Mod cancerinform's Avatar
    Join Date
    Mar 2002
    press the picture...
    Wrong forum, moved to Actionscript.
    - The right of the People to create Flash movies shall not be infringed. -

  3. #3
    Join Date
    Apr 2006
    There are quite a few ways to go about this, but look into these thoughts...

    Try not to name them all the same thing. Name them like:
    hamburger1, hamburger2, ect. ect. Make sure all the names end up unique.

    Now.. you can add dynamic codes to each object added to the flash application.
    var current_burger = false;
    function blahfunc() {
      current_burger = false;
    function blahfuntwo(){
      current_burger = false;
    _root.["hamburger1"].onMouseDown() = blahfunc();
    _root["hamburger1"].onRelease() = blahfunctwo();
    // do this for every hamburger added!
    _root.hamburger[2].onClipEvent(enterFrame) = function(){
      if(this.hitzone4.hitTest(current_burger)) {
        this._x = 62;
        this._y = 60.5;
    This should give you an idea.... just look at the code and play around with it. And, I think the _root["hamburger1"].onMouseDown() and such should just be like _root.["hamburger1"].onMouseDown(), but it's been a long time since I had to do anything like that.... so I forget.
    Last edited by LifeToTake; 05-17-2008 at 06:16 AM.

Posting Permissions

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

Click Here to Expand Forum to Full Width

HTML5 Development Center