Public Voice Network
- gramme Jr. has finally ar… 1515
- Hanging up posters? 11
- industrial music 1111
- HTML Email footer 1111
- Showing Websites In A Pri… 66
- jteore 131131
- your philosophy 2929
- jteore! 5050
- Viral campaign ideas 1111
- Tattoo ideas for foot 4646
- Site Critique #2 2222
- Minivegas AIDS PSA 55
- What do you call "It… 258258
- recommended Flash classes… 44
- Logo, Looking for Feedbac… 3838
- Politics 21102110
- Tapas in nyc 66
- why don't they count … 1818
- blog 2737427374
- Lightwave 2828
- Type Connect 6161
- hotel626 can you win? 22
- fonts and Flash 66
- Yet another logo crit 1818
as3 quick q 77 Responses
Last post: 7 months, 1 week 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


