Public Voice Network
- Why are hackers always ah… 1818
- blog 3028230282
- Ignore button please. 3232
- Mirror's Edge = vomit… 2424
- Your latest DESIGN purcha… 203203
- What does the future hold… 99
- ripping videos from sites 77
- best way to determine you… 1717
- Hen Party... 4141
- Your latest print purchas… 77
- trim/shave 88
- Happy VI Day
- skulls 5050
- Pic of the Day 1019410194
- water marks on letterhead… 44
- QBN Spam Report 2121
- serif fonts 1616
- Why, why, why? 1010
- FMT 112108 3232
- party @ simonyi's 33
- Vid of the Day 151151
- FFFind me a FFFound 44
- Carsten Holler - London 22
- Agencies WTF! 2929
as3 quick q 77 Responses
Last post: 8 months, 3 weeks ago | Thread started: Mar 6, 08, 7:09 a.m.
- enjine
there is a method to do this on every subclass of DisplayObjectContainer (i.e. Sprite, MovieClip, ...). From the language reference:
Determines whether the specified display object is a child of the DisplayObjectContainer instance or the instance itself. The search includes the entire display list including this DisplayObjectContainer instance. Grandchildren, great-grandchildren, and so on each return true.
Parameters
child:DisplayObject — The child object to test.Returns
Boolean — true if the child object is a child of the DisplayObjectContainer or the container itself; otherwise false.Example
The following example sets up a number of Sprite objects and adds some to the child list of others. (A Sprite object is a type of display object container.) The relationship between various objects is shown by calling the contains() method:import flash.display.Sprite;
var sprite1:Sprite = new Sprite();
var sprite2:Sprite = new Sprite();
var sprite3:Sprite = new Sprite();
var sprite4:Sprite = new Sprite();sprite1.addChild(sprite2);
sprite2.addChild(sprite3);trace(sprite1.contains(sprite1… // true
trace(sprite1.contains(sprite2… // true
trace(sprite1.contains(sprite3… // true
trace(sprite1.contains(sprite4… // false

- Dog-earMar 6, 08, 7:25 a.m. – Permalink


