?
Solved

Movie Clip Position Validation

Posted on 2003-11-04
3
Medium Priority
?
315 Views
Last Modified: 2010-04-03
This is related to another question I just asked but since the subjects are different I wanted to separate the questions:

Assuming the you have a movie clip that can be dragged around on the stage, is there a way to validate the position of the clip?

For example, I have a movie where different letters are setup as movie clips so that they can be dragged into boxes.  Once the letter is dragged into the box, I would like to use the y position of the movie clip to see if the correct letter is in the correct box.

I'm not sure how I want the user to find out if the letter is correct.  Maybe I could change the white box to red if wrong and green is correct.  Or I could set up a check answer button...

Anyone got any suggestions on how to validate the y position of the clip and how to automatically change the color of the box.

Here's the sample:

http://planetallison.com/ee/snapto/dls3.swf

0
Comment
Question by:skibama1
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 5

Accepted Solution

by:
Calron earned 300 total points
ID: 9685012
There is a method you can use on movieclips that is called hitTest. staticmc.hitTest(letter.mc); returns true or false.

So again check for the collision when stopping the dragging and snap to the correct position.

Check this page for an example of this:

http://www.actionscript-toolbox.com/samplemx_bounceCollide.php
0
 
LVL 39

Assisted Solution

by:blue-genie
blue-genie earned 200 total points
ID: 9694202
Hi skibama1,

What you want to do can be achieved by simply setting a variable to find the _y of the movieclip on realease.

so assuming you have your code directly on the movieclip that's being dragged around.

on (release) {
 stopDrag();
 var newY = this._y;
}

this will give you the y position of the movieclip, however I would not recommend you use this approach for the very simple reason that where you drag it could vary, and the _y has to be exact to be correct, unless you use a snap to target approach to ensure a precise _y.

hope that makes sense.

blu
0
 
LVL 1

Author Comment

by:skibama1
ID: 9696970
Yeah, I think I am going to combine the hitTest method with setting the variables for "answer validation".

Calron's suggestion helped, although I learned more about the hitTest from a Actionscript reference book that I have.

I'm going to leave this open for a few days until I get everything ironed out.

Thanks!
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is a very simple example to help those of you who are still migrating from AS2 to AS3 understand the redesigned event model in AS3. In AS2.0, event functions (that is, the function to be performed when an event is fired) were stored as a pro…
This is intended to introduce all collision detection principles in flash, their strengths, weaknesses and workarounds. The main method for Collision Detection in flash is using hitTestObject. But unless you'll be pushing rectangular shapes without …
In this tutorial viewers will learn how to create a basic shape tween animation in Flash including shape hints for smooth animation Open a new document in Flash: Draw a shape: Select another frame (how long you want the tween to be): Right click and…
The goal of the tutorial is to teach the user how to how to load their YouTube profile onto Flash Media Live Encoder.
Suggested Courses

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question