Home Tutorials Forums Articles Blogs Movies Library Employment Press Buy templates

Go Back   ActionScript.org Forums > General > Gaming and Game Development

Reply
 
Thread Tools Rate Thread Display Modes
Old 10-29-2001, 06:27 PM   #1
madness
Registered User
 
Join Date: Oct 2001
Location: Minneapolis
Posts: 18
Default hitTest and drag on a masked layer object

I am making a jigsaw puzzle which consists of many movie clips that have the same photo masked out of different puzzle piece shapes.

I can get the pieces to drag around and drop into the correct space just fine, but my mouse doesn't move around the piece directly under it. Rather it seems to grab the entire area of the (hidden) masked photo (meaning it usually picks up which ever piece is closest to the top vs. just the puzzle piece shape).

Is it possible to use the hitTest command on a masked layer in a mc so that it only returns the value "true" if on the masked layer and not the entire image hidden behind it?

Or is there someway for me to create coordinates on each individual mc so that the mouse drags the one under it versus whichever piece is on top?

If this is all too confusing I can post my example. Thanks!
madness is offline   Reply With Quote
Old 10-30-2001, 03:20 PM   #2
madness
Registered User
 
Join Date: Oct 2001
Location: Minneapolis
Posts: 18
Default check out URL

I've posted the swf file at:
http://members.tripod.com/mclarke8/shaverGame.html

Unfortunately the fla is too large for me to upload there, but the main question is: how to target the piece that shows through the mask versus the entire masked photo?

Add another movie clip on top, combine those and target it instead? If anyone can think of something else to try it would be most appreciated.
madness is offline   Reply With Quote
Old 10-30-2001, 04:05 PM   #3
poab
two hundred & thirty two
 
Join Date: Jul 2001
Posts: 334
Default

Hi,

Each piece should be in a MC of it's own. Make a button that's the same size and shape as your mask by copying and pasting onto a new layer. Now you have a button under the mask and masked layers add this code to it:

on(press){
startDrag(PATH TO MC GOES HERE, false); //change 'false' to 'true' if you want the MC centered on the mouse
}
on(release){
stopDrag();
}

It might be an idea to alter the levels of the MCs too. So when someone clicks one that's the bottom of the pile it rises to the top.

cheers.
poab is offline   Reply With Quote
Old 10-30-2001, 06:12 PM   #4
madness
Registered User
 
Join Date: Oct 2001
Location: Minneapolis
Posts: 18
Default

Thanks poab,

Each piece is its own mc right now, but I'll try the button idea to see if it restricts the hit area. Your changing levels idea is a good one, I'll give that a shot too.
madness is offline   Reply With Quote
Old 10-30-2001, 06:35 PM   #5
geak
simply g3aky
 
Join Date: Jan 2001
Location: Denver - CO
Posts: 248
Default

Also a little unknown hint. The bounds of the MC is not defined by the mask but by the entire contents of the MC. So you either need to use an invisible button as poab suggested or if you break your image in each MC ie Ctrl or comman -B you can then use the white mouse pointer, the one that you use for modifying bezier curve handles with, and you can grab the corner node of the picture and shrink it to the bounds of the mask. This sounds a little confusing I know but it works.
geak is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
hitTest to drag tinyk Simple Stuff (Newbies) 9 07-13-2005 12:41 AM
remove hitTest?? toke ActionScript 1.0 (and below) 5 09-15-2004 07:57 PM
hittest problem caffrey75 ActionScript 1.0 (and below) 3 08-17-2004 05:10 PM
cant re-enable an object. tg ActionScript 1.0 (and below) 0 08-11-2003 04:12 PM


All times are GMT. The time now is 09:38 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2009 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.