Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Movie Clip Position Validation

Posted on 2003-11-04
3
Medium Priority
?
316 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This article describes a solution to a problem of subloading one movie into another when they have different SWF versions. Sometime back, I was working on an ActionScript project while I came across an interesting fact which I would like to share…
I have been doing hardcore actionscripting for some time; and needless to say I have faced a lot of problems in just understanding others' code rather than understanding what the code executes. A programmer's life can become hell when there are a lo…
The goal of the tutorial is to teach the user how to live broadcast using Flash Media Live Encoder and connecting it to YouTube to broadcast. Log into your Youtube account, choose live stream settings, start live stream from Flash Media Live Enc…
The goal of the tutorial is to teach the user how to select the video input device. Make sure you have an input device that in connected and work and recognized by Adobe Flash Media Live Encoder and select it in the “video input” menu.

609 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