View Full Version : Determine movieclip under another movieclip?
frank grimes
10-30-2007, 06:26 AM
Howdy,
Is it possible to get the name of the movieclip instance that sits underneath another movieclip instance without knowing the underneath movieclip name?
Is there a builtin function within AS3?
many thanks,
frank grimes
panel
10-30-2007, 11:57 AM
you could loop all childrens of display object
while(container.numChildren)
{
container.name;
}
dr_zeus
10-30-2007, 04:50 PM
The getObjectsUnderPoint() (http://livedocs.adobe.com/flex/201/langref/flash/display/DisplayObjectContainer.html#getObjectsUnderPoint() ) function might be useful to you.
frank grimes
10-30-2007, 10:47 PM
Thanks for the help guys. I think my approach for this is incorrect.
I am trying to build a board game spinner that the user can press and the little needle spins around then lands a particular spot. I am using the Tweener class to handle the rotation of the spinner needle which does an excellent job.
The tricky part now is trying to figure out which number movieclip the needle has landed on top of....
I tried the getObjectsUnderPoint() method using the arrow_mc.x and arrow_mc.y values but it kept returning back an array with 3+ items which means it's capturing other information.
What I'd like to be able to do is pass it an x,y coordinate of the tip of the arrow but i would have no idea if that's even possible to calculate.
What's odd is that when I use the Tweener class to rotate the arrow_mc its x and y coordinates never change. Wouldn't those values change as the movieclip is rotated? At least if those value did change I could possible calculate the position of the arrrow mc.
Any suggestions?
Many thanks in advance!
frank grimes
|
vBulletin® v3.8.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.