Re: [Flashcoders] how to check if child exists
If the display object is checking itself, all you have to do is check to see if stage == null. Otherwise, you can see if its parent contains it. parentClip.contains(dispObj); that said, i'd still like to know how to determine if a display object is in the current display list? ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] how to check if child exists
You are using contains() and it is just for that purpose. Kenneth Kawamoto http://www.materiaprima.co.uk/ Allandt Bik-Elliott (Receptacle) wrote: that said, i'd still like to know how to determine if a display object is in the current display list? thanks a On 2 Apr 2008, at 16:35, Kenneth Kawamoto wrote: Place outside of the function -> private var eventList:Sprite; Kenneth Kawamoto http://www.materiaprima.co.uk/ Allandt Bik-Elliott (Receptacle) wrote: hmmm - i'm a little stuck on this i'm trying to create a pop-up (will tween but i want to get it working first) but i want it to kill any previous one that's up - how would i go about this please? here's my current code: CODE private function createEventList(pbList_xl:XMLList):void { if (this.contains(eventList)) removeChild(eventList); // remove previous eventList if it's available - this is the bit that needs fixing var listLength:int = pbList_xl.length(); var listentryHeight:int = 15; var listHeight:int = listLength * listentryHeight; var listWidth:int= 50; var mousePoint:Point= new Point(root.mouseX, root.mouseY); // will tween from this point to a central point on the stage var eventList:Sprite = new Sprite(); eventList.graphics.beginFill(commonGrey, 1); eventList.graphics.drawRoundRect(0, 0, listWidth, listHeight, 10); eventList.x = mousePoint.x; eventList.y = mousePoint.y; addChild(eventList); } /CODE hope you can help a Allandt Bik-Elliott thefieldcomic.com e [EMAIL PROTECTED] ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] how to check if child exists
displayObjectContainer.contains(child) On Wed, Apr 2, 2008 at 9:36 AM, Allandt Bik-Elliott (Receptacle) < [EMAIL PROTECTED]> wrote: > that said, i'd still like to know how to determine if a display object is > in the current display list? > > thanks > a > > > On 2 Apr 2008, at 16:35, Kenneth Kawamoto wrote: > > Place outside of the function -> private var eventList:Sprite; > > > > Kenneth Kawamoto > > http://www.materiaprima.co.uk/ > > > > Allandt Bik-Elliott (Receptacle) wrote: > > > > > hmmm - i'm a little stuck on this > > > i'm trying to create a pop-up (will tween but i want to get it working > > > first) but i want it to kill any previous one that's up - how would i go > > > about this please? > > > here's my current code: > > > CODE > > >private function createEventList(pbList_xl:XMLList):void > > >{ > > >if (this.contains(eventList)) removeChild(eventList); // > > > remove previous eventList if it's available - this is the bit that needs > > > fixing > > >var listLength:int = pbList_xl.length(); > > >var listentryHeight:int = 15; > > >var listHeight:int = listLength * listentryHeight; > > >var listWidth:int= 50; > > >var mousePoint:Point= new Point(root.mouseX, > > > root.mouseY); // will tween from this point to a central point on the > > > stage > > > var eventList:Sprite = new Sprite(); > > >eventList.graphics.beginFill(commonGrey, 1); > > >eventList.graphics.drawRoundRect(0, 0, listWidth, > > > listHeight, 10); > > >eventList.x = mousePoint.x; > > >eventList.y = mousePoint.y; > > > addChild(eventList); > > >} > > > /CODE > > > hope you can help > > > a > > > Allandt Bik-Elliott > > > thefieldcomic.com > > > e [EMAIL PROTECTED] > > > > > ___ > > Flashcoders mailing list > > Flashcoders@chattyfig.figleaf.com > > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > > > > > > ___ > Flashcoders mailing list > Flashcoders@chattyfig.figleaf.com > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > -- Ketan Anjaria 415.260.8742 f. 415-358-4278 [EMAIL PROTECTED] www.kidbombay.com ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] how to check if child exists
From the help files and modified a bit. It is probably more efficient to keep track of names and the do a getChildByName(string) function traceDisplayList(container:DisplayObjectContainer, DispObjToCheck:DisplayObject) : Boolean { var child:DisplayObject; for (var i:uint=0; i < container.numChildren; i++) { child = container.getChildAt(i); if(child == DispObjToCheck){ //found it and break out of the loop return true; } if (container.getChildAt(i) is DisplayObjectContainer) { traceDisplayList(DisplayObjectContainer(child), DispObjToCheck) } } return false } Jiri Allandt Bik-Elliott (Receptacle) wrote: that said, i'd still like to know how to determine if a display object is in the current display list? thanks a On 2 Apr 2008, at 16:35, Kenneth Kawamoto wrote: Place outside of the function -> private var eventList:Sprite; Kenneth Kawamoto http://www.materiaprima.co.uk/ Allandt Bik-Elliott (Receptacle) wrote: hmmm - i'm a little stuck on this i'm trying to create a pop-up (will tween but i want to get it working first) but i want it to kill any previous one that's up - how would i go about this please? here's my current code: CODE private function createEventList(pbList_xl:XMLList):void { if (this.contains(eventList)) removeChild(eventList); // remove previous eventList if it's available - this is the bit that needs fixing var listLength:int = pbList_xl.length(); var listentryHeight:int = 15; var listHeight:int = listLength * listentryHeight; var listWidth:int= 50; var mousePoint:Point= new Point(root.mouseX, root.mouseY); // will tween from this point to a central point on the stage var eventList:Sprite = new Sprite(); eventList.graphics.beginFill(commonGrey, 1); eventList.graphics.drawRoundRect(0, 0, listWidth, listHeight, 10); eventList.x = mousePoint.x; eventList.y = mousePoint.y; addChild(eventList); } /CODE hope you can help a Allandt Bik-Elliott thefieldcomic.com e [EMAIL PROTECTED] ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] how to check if child exists
that said, i'd still like to know how to determine if a display object is in the current display list? thanks a On 2 Apr 2008, at 16:35, Kenneth Kawamoto wrote: Place outside of the function -> private var eventList:Sprite; Kenneth Kawamoto http://www.materiaprima.co.uk/ Allandt Bik-Elliott (Receptacle) wrote: hmmm - i'm a little stuck on this i'm trying to create a pop-up (will tween but i want to get it working first) but i want it to kill any previous one that's up - how would i go about this please? here's my current code: CODE private function createEventList(pbList_xl:XMLList):void { if (this.contains(eventList)) removeChild (eventList); // remove previous eventList if it's available - this is the bit that needs fixing var listLength:int = pbList_xl.length(); var listentryHeight:int = 15; var listHeight:int = listLength * listentryHeight; var listWidth:int= 50; var mousePoint:Point= new Point(root.mouseX, root.mouseY); // will tween from this point to a central point on the stage var eventList:Sprite = new Sprite(); eventList.graphics.beginFill(commonGrey, 1); eventList.graphics.drawRoundRect(0, 0, listWidth, listHeight, 10); eventList.x = mousePoint.x; eventList.y = mousePoint.y; addChild(eventList); } /CODE hope you can help a Allandt Bik-Elliott thefieldcomic.com e [EMAIL PROTECTED] ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] how to check if child exists
that's actually helped me implement a movieActive variable so i've decided to go down that route instead - thanks for the input On 2 Apr 2008, at 16:35, Kenneth Kawamoto wrote: Place outside of the function -> private var eventList:Sprite; Kenneth Kawamoto http://www.materiaprima.co.uk/ Allandt Bik-Elliott (Receptacle) wrote: hmmm - i'm a little stuck on this i'm trying to create a pop-up (will tween but i want to get it working first) but i want it to kill any previous one that's up - how would i go about this please? here's my current code: CODE private function createEventList(pbList_xl:XMLList):void { if (this.contains(eventList)) removeChild (eventList); // remove previous eventList if it's available - this is the bit that needs fixing var listLength:int = pbList_xl.length(); var listentryHeight:int = 15; var listHeight:int = listLength * listentryHeight; var listWidth:int= 50; var mousePoint:Point= new Point(root.mouseX, root.mouseY); // will tween from this point to a central point on the stage var eventList:Sprite = new Sprite(); eventList.graphics.beginFill(commonGrey, 1); eventList.graphics.drawRoundRect(0, 0, listWidth, listHeight, 10); eventList.x = mousePoint.x; eventList.y = mousePoint.y; addChild(eventList); } /CODE hope you can help a Allandt Bik-Elliott thefieldcomic.com e [EMAIL PROTECTED] ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] how to check if child exists
Place outside of the function -> private var eventList:Sprite; Kenneth Kawamoto http://www.materiaprima.co.uk/ Allandt Bik-Elliott (Receptacle) wrote: hmmm - i'm a little stuck on this i'm trying to create a pop-up (will tween but i want to get it working first) but i want it to kill any previous one that's up - how would i go about this please? here's my current code: CODE private function createEventList(pbList_xl:XMLList):void { if (this.contains(eventList)) removeChild(eventList); // remove previous eventList if it's available - this is the bit that needs fixing var listLength:int = pbList_xl.length(); var listentryHeight:int = 15; var listHeight:int = listLength * listentryHeight; var listWidth:int= 50; var mousePoint:Point= new Point(root.mouseX, root.mouseY); // will tween from this point to a central point on the stage var eventList:Sprite = new Sprite(); eventList.graphics.beginFill(commonGrey, 1); eventList.graphics.drawRoundRect(0, 0, listWidth, listHeight, 10); eventList.x = mousePoint.x; eventList.y = mousePoint.y; addChild(eventList); } /CODE hope you can help a Allandt Bik-Elliott thefieldcomic.com e [EMAIL PROTECTED] ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
[Flashcoders] how to check if child exists
hmmm - i'm a little stuck on this i'm trying to create a pop-up (will tween but i want to get it working first) but i want it to kill any previous one that's up - how would i go about this please? here's my current code: CODE private function createEventList(pbList_xl:XMLList):void { if (this.contains(eventList)) removeChild(eventList); // remove previous eventList if it's available - this is the bit that needs fixing var listLength:int = pbList_xl.length(); var listentryHeight:int = 15; var listHeight:int = listLength * listentryHeight; var listWidth:int = 50; var mousePoint:Point = new Point(root.mouseX, root.mouseY); // will tween from this point to a central point on the stage var eventList:Sprite = new Sprite(); eventList.graphics.beginFill(commonGrey, 1); eventList.graphics.drawRoundRect(0, 0, listWidth, listHeight, 10); eventList.x = mousePoint.x; eventList.y = mousePoint.y; addChild(eventList); } /CODE hope you can help a Allandt Bik-Elliott thefieldcomic.com e [EMAIL PROTECTED] ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders