A Flash Developer Resource Site

Page 3 of 3 FirstFirst 123
Results 41 to 49 of 49

Thread: Snap

  1. #41
    Senior Member chi-styler's Avatar
    Join Date
    Jul 2001
    Location
    Bristol, UK
    Posts
    1,237
    All you need to do is find out which target the apple was on:

    if (this.hitTest(_root["target"+j]))

    and use that value of j to set that particular element of the array back to false(which allows the apple (or another one) to be put back there):

    taken[j] = false;

    Just that inside a simple do loop which increments j each time:

    do {
    j++;
    ....
    } while(j<16)




  2. #42
    FK's Official War Driver wiReZ's Avatar
    Join Date
    Jun 2002
    Location
    wireless
    Posts
    615
    Where would I put the do loop?

  3. #43
    Senior Member chi-styler's Avatar
    Join Date
    Jul 2001
    Location
    Bristol, UK
    Posts
    1,237
    in the onPress

  4. #44
    FK's Official War Driver wiReZ's Avatar
    Join Date
    Jun 2002
    Location
    wireless
    Posts
    615
    Hmm, just went to lunch, came back...I am now Lost. I think I am just gonna give up on this part of the script. Thanks for all the help guys.

  5. #45
    Senior Member chi-styler's Avatar
    Join Date
    Jul 2001
    Location
    Bristol, UK
    Posts
    1,237
    Ah, jeez louise, this should be your onPress:

    Code:
    ref.onPress = function() {
      startDrag(this, false, 0, 0, Stage.width, Stage.height);
      j=0;
      checkVal = false;
      do {
        j++;
        if (this.hitTest(_root["target"+j])) {      
          taken[j] = false;
          checkVal = true;
        }
      }while(j < 16 && !checkVal)
    };
    Ok?

  6. #46
    FK's Official War Driver wiReZ's Avatar
    Join Date
    Jun 2002
    Location
    wireless
    Posts
    615
    Look, its still not working for me. Those damn apples are always able to be in the same targets.

  7. #47
    Senior Member chi-styler's Avatar
    Join Date
    Jul 2001
    Location
    Bristol, UK
    Posts
    1,237
    http://www.chistyler.com/final2.fla

    At my end you can't drag two apples onto the same target

  8. #48
    FK's Official War Driver wiReZ's Avatar
    Join Date
    Jun 2002
    Location
    wireless
    Posts
    615
    Your FLA is as far as I have gotten before. Sometimes after dragging out of a previously placed apple, it puts the apple at 0x 0y references. Sometimes, it even lets 2 apples inside after one has left.
    Like I said, this is seriously very complicating. You are obviously more skilled in this topic than me, and yet your FLA is as far as I have got. I am just going to abandon this part of the work.

  9. #49
    Senior Member chi-styler's Avatar
    Join Date
    Jul 2001
    Location
    Bristol, UK
    Posts
    1,237
    My apologies, I hadn't tested it extensively enough

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