[Flashcoders] Testing before removing a child

2009-11-18 Thread Alan Neilsen
I am using loader_clip.removeChild(ldr); to remove child objects from my loader 
clip, and I want to test if a child object is there before removing it. I 
thought it would be something like
if (loader_clip.child !=0) {   // or !=, or !=null, or ==true, or 
something like that
loader_clip.removeChild(ldr);
}

But when I trace (loader_clip.child) it comes back undefined whether the 
child is still there or not.

What can I use to test this so loader_clip.removeChild(ldr); doesn't produce an 
error if the child has already been removed?
Alan Neilsen


This message is for the named person’s use only. It may contain
confidential, proprietary or legally privileged information. No
confidentiality or privilege is waived or; lost by any mistransmission. If
you receive this message in error, please immediately delete it and all
copies of it from your system, destroy any hard copies of it and notify
the sender. You must not directly or indirectly, use, disclose,
distribute, print or copy any part of this message if you are not the
intended recipient. GOULBURN OVENS INSTITUTE OF TAFE and
any of its subsidiaries each reserve the right to monitor all e-mail
communications through its networks. Any views expressed in this
message are those of the individual sender, except where the
message states otherwise and the sender is authorised to state them
to be the views of any such entity.

#
This e-mail message has been scanned for Viruses and Content and cleared 
by MailMarshal
#
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Testing before removing a child

2009-11-18 Thread Gregory Boland
try .numChildren property

On Wed, Nov 18, 2009 at 4:48 PM, Alan Neilsen aneil...@gotafe.vic.edu.auwrote:

 I am using loader_clip.removeChild(ldr); to remove child objects from my
 loader clip, and I want to test if a child object is there before removing
 it. I thought it would be something like
 if (loader_clip.child !=0) {   // or !=, or !=null, or ==true, or
 something like that
loader_clip.removeChild(ldr);
 }

 But when I trace (loader_clip.child) it comes back undefined whether the
 child is still there or not.

 What can I use to test this so loader_clip.removeChild(ldr); doesn't
 produce an error if the child has already been removed?
 Alan Neilsen


 This message is for the named person’s use only. It may contain
 confidential, proprietary or legally privileged information. No
 confidentiality or privilege is waived or; lost by any mistransmission. If
 you receive this message in error, please immediately delete it and all
 copies of it from your system, destroy any hard copies of it and notify
 the sender. You must not directly or indirectly, use, disclose,
 distribute, print or copy any part of this message if you are not the
 intended recipient. GOULBURN OVENS INSTITUTE OF TAFE and
 any of its subsidiaries each reserve the right to monitor all e-mail
 communications through its networks. Any views expressed in this
 message are those of the individual sender, except where the
 message states otherwise and the sender is authorised to state them
 to be the views of any such entity.


 #
 This e-mail message has been scanned for Viruses and Content and cleared
 by MailMarshal

 #
 ___
 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] Testing before removing a child

2009-11-18 Thread Francis Turmel
If I understand properly what you mean, the contains method is what you're
looking for.

if (loader_clip.contains(ldr)){
loader_clip.removeChild(ldr);
}

http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/display/DisplayObjectContainer.html#contains%28%29



On Wed, Nov 18, 2009 at 8:25 PM, Gregory Boland
breakfastcof...@gmail.comwrote:

 try .numChildren property

 On Wed, Nov 18, 2009 at 4:48 PM, Alan Neilsen aneil...@gotafe.vic.edu.au
 wrote:

  I am using loader_clip.removeChild(ldr); to remove child objects from my
  loader clip, and I want to test if a child object is there before
 removing
  it. I thought it would be something like
  if (loader_clip.child !=0) {   // or !=, or !=null, or ==true, or
  something like that
 loader_clip.removeChild(ldr);
  }
 
  But when I trace (loader_clip.child) it comes back undefined whether
 the
  child is still there or not.
 
  What can I use to test this so loader_clip.removeChild(ldr); doesn't
  produce an error if the child has already been removed?
  Alan Neilsen
 
 
  This message is for the named person’s use only. It may contain
  confidential, proprietary or legally privileged information. No
  confidentiality or privilege is waived or; lost by any mistransmission.
 If
  you receive this message in error, please immediately delete it and all
  copies of it from your system, destroy any hard copies of it and notify
  the sender. You must not directly or indirectly, use, disclose,
  distribute, print or copy any part of this message if you are not the
  intended recipient. GOULBURN OVENS INSTITUTE OF TAFE and
  any of its subsidiaries each reserve the right to monitor all e-mail
  communications through its networks. Any views expressed in this
  message are those of the individual sender, except where the
  message states otherwise and the sender is authorised to state them
  to be the views of any such entity.
 
 
 
 #
  This e-mail message has been scanned for Viruses and Content and cleared
  by MailMarshal
 
 
 #
  ___
  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