hmm almost got this one working... it doesn't handle one case ( when
the number of steps is greater than two ). will finish it tomorrow, it
can give you some ideas for now


                public static function getDisplayObjectsUnderMouse():Array
                {
                        var app:Application = Application.application as 
Application;
                        
                        var arr:Array = app.stage.getObjectsUnderPoint( new 
Point(
app.stage.mouseX, app.stage.mouseY ) );
                        var stack:Array = new Array();
                        for ( var i:int=arr.length-1; i>=1; i-- )
                        {
                                var current:Object = arr[i];
                                var parent:Object = null;
                                
                                if ( current.hasOwnProperty("parent") )
                                {
                                        parent = current.parent;
                                }
                                else if (  current.hasOwnProperty("owner") )
                                {
                                        parent = current.owner;
                                }
                                else
                                {
                                        // trace( current + " doesn't have 
either parent nor owner");
                                }
                                
                                if ( parent != null && stack[ stack.length-1 ] 
== parent )
                                        stack.pop();
                                
                                stack.push( current );
                                stack.push( parent );
                        }
                        return stack;
                }               




On 8/28/06, Gordon Smith <[EMAIL PROTECTED]> wrote:
>
>
>
>
>
> Actually, what it is excluding is DisplayObjects that haven't drawn anything 
> at the point in question. For example, if you click over the text of a 
> Button,  the UITextField and the ButtonSkin will be in the Array, but the 
> Button instance won't be because it doesn't display anything itself. 
> Similarly, a transparent HBox won't show up. You'd have to walk up the parent 
> chain to find non-drawing DisplayObjects like these.
>
>
>
> - Gordon
>
>
>
>   ________________________________

>
> From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of 
> Daniel Freiman
>  Sent: Monday, August 28, 2006 1:39 PM
>  To: [email protected]
>  Subject: Re: [flexcoders] Getting al DisplayObjects under a given global 
> Point
>
>
>
>
>
>
>
> I've tried using this function and it seems to exclude 
> DisplayObjectContainers (in other words it only returns DisplayObjects, not 
> classes that are a subclass of DisplayObject).  Is there any convenient way 
> to get a list of other types of objects, such as UIComponents?
>
>
> On 8/28/06, Gordon Smith <[EMAIL PROTECTED]> wrote:
>
>
>
>
> Every DisplayObjectContainer has a getObjectsUnderPoint() method.
>
>
>
> - Gordon
>
>
>
>   ________________________________

>
> From: [email protected] [mailto: [EMAIL PROTECTED] On Behalf Of Aldo 
> Bucchi
>  Sent: Monday, August 28, 2006 12:03 PM
>  To: [email protected]
>  Subject: [flexcoders] Getting al DisplayObjects under a given global Point
>
>
>
>
>
>
> Hi all,
>
>  I remember writing an as2 class a long time ago that traversed the
>  complete movieclip tree and could figure this out by doing recursive
>  hit tests.
>
>  Is there an elegant way of doing it in Flex2??
>
>  Get the stack ( an array ) of all the DisplayObjects at a given point
>  in the global coordinate system.
>
>  Thanks ;)
>  Aldo
>
>  --
>  ::::: Aldo Bucchi :::::
>  mobile (56) 8 429 8300
>
>
>
>    
>



-- 
::::: Aldo Bucchi :::::
mobile (56) 8 429 8300


--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to