Skip navigation
Currently Being Moderated

How to make symbol become designated drop area?

Mar 25, 2013 6:24 PM

Tags: #drop #cs5 #flash #as3.0 #symbol #area #become #designated

Previvious discussion


ok this is what I got so far, four squares on the grid, respectively named: squareC1, squareC2, squareC3, squareC4. Now I want the square that we named smallSquareName to be able to fit in any of the other four, how do I tell AS3 that smallSquareName can fit in any of these squareC1, squareC2, squareC3, squareC4, at the user’s will, because as it is now smallSquareName can roam freely all over the screen (not that it is a bad thing) But just like a game of chess I want smallSquareName to move according to the guidelines of the game.

Anticipating thanks

  • Currently Being Moderated
    Mar 25, 2013 7:50 PM   in reply to Windbutnu

    Dropping is a manual interaction involving releasing the mouse button.  If you are dragging the small square, you caqn control/limit where it can go by soecifying a rectanular boundary, but it is not clear how you intend to limit the movement. 


    If you want to see how to implement the rectanglular boundary either look up the startDrag method in the help documentation ot search Google for "AS3 startDrag tutorial"

    Mark as:
  • Currently Being Moderated
    Mar 26, 2013 4:23 AM   in reply to Windbutnu

    put your 4 targetsquares in an Array

    then upon releasing the mouse (stopDrag),

    check if the "PAWN" collides with any of these 4 squares

    with hitTestObject, and if so

    Tween it to the position of this square

    if not

    Tween it back to the place where the player started his dragging

    Mark as:
  • Currently Being Moderated
    Mar 26, 2013 4:35 AM   in reply to Windbutnu

    You need to make your game intelligent enough to know what targets are valid ones for any movement of the small square. As the oher response indicates, you could place all the legitimate targets into an array an check if that array contains the drop target when the drop occurs, and if so, align the small square to that drop target.

    Mark as:
  • Currently Being Moderated
    Mar 26, 2013 11:40 PM   in reply to Windbutnu

    No offense, but at this time you have shown no line of actual code you have written, nor a screenshot of a mockup you made.

    This is a repeating patterrn, obviously, because the last thread you made (and linked to in the first post) didn`t show anything you have written, too.

    I doubt anyone will fix your files for you.


    when I try to use the  hitTestObject mentioned Im getting all sort of error

    Show the errors, and show the code that is triggering them

    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points