1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
|
<?xml version="1.0" encoding="utf-8"?>
<mx:Application creationComplete="init();" layout="absolute" xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Script>
<![CDATA[
import flash.display.DisplayObject;
import flash.display.Sprite;
import flash.events.MouseEvent;
import flash.geom.Point;
import mx.core.Application;
private function init():void
{
cvs1.addEventListener(MouseEvent.CLICK, onClick, true);
}
private function onClick(e:MouseEvent):void
{
var objs:Array = (e.currentTarget as Sprite).getObjectsUnderPoint(new Point(e.stageX, e.stageY));
var i:int = 0;
trace("Objets sous ce point, du plus lointain au plus proche :");
for each (var obj:DisplayObject in objs)
{
trace(i+" : "+obj.toString());
i++;
}
}
]]>
</mx:Script>
<mx:Canvas id="cvs1" width="100%" height="100%">
<mx:Panel id="panel_0" x="750" y="520" layout="absolute" height="200" width="200" />
<mx:Panel id="panel_1" x="150" y="120" layout="absolute" height="500" width="700">
<mx:Panel id="panel_10" x="250" y="320" layout="absolute" height="150" width="100">
<mx:Panel id="panel_101" x="50" y="20" layout="absolute" height="200" width="150" />
</mx:Panel>
<mx:Panel id="panel_11" x="25" y="220" layout="absolute" height="100" width="200" />
</mx:Panel>
</mx:Canvas>
</mx:Application> |