PhotoDune

as3 check if movieclip exists?

1234 posts
  • Bought between 50 and 99 items
  • Elite Author
  • Exclusive Author
  • Has been a member for 4-5 years
  • Referred between 50 and 99 users
  • Sold between 50 000 and 100 000 dollars
  • United States
MBMedia says

there is multple things you have to check, 1) if it exists 2) if it is in the display list of the movieclip you want. check this:

http://pastie.org/395812

And don’t use names of movie clips to find stuff, that’s AS2 crap :P Reference the movie clip itself.

2309 posts
  • Beta Tester
  • Bought between 10 and 49 items
  • Exclusive Author
  • Has been a member for 5-6 years
  • Referred between 10 and 49 users
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • Sold between 100 and 1 000 dollars
  • United States
theflyingtinman says

Don’t you just love it when noobs turn up on the forums answering months-old threads in their first post :) That’s the second one in a week :P

8 posts
  • Bought between 1 and 9 items
  • Exclusive Author
  • Has been a member for 4-5 years
viaria says

what is this doing

if(mc){ //on stage } else { // not on stage.. }

i am using this, and works fine

1 post
  • Exclusive Author
  • Has been a member for 4-5 years
pslanca says

well, this works for me…

try{ trace(getChildIndex(DisplayObject)); }catch(e:Error){ //create it }

Thanks,

2309 posts
  • Beta Tester
  • Bought between 10 and 49 items
  • Exclusive Author
  • Has been a member for 5-6 years
  • Referred between 10 and 49 users
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • Sold between 100 and 1 000 dollars
  • United States
theflyingtinman says
well, this works for me…

try{ trace(getChildIndex(DisplayObject)); }catch(e:Error){ //create it }

Thanks,

Wow .. deja vu all over again

8 posts
  • Bought between 1 and 9 items
  • Exclusive Author
  • Has been a member for 4-5 years
viaria says

this is wrong, if(mc){ //on stage } else { // not on stage.. }

this is right getChildIndex(DisplayObject);

2309 posts
  • Beta Tester
  • Bought between 10 and 49 items
  • Exclusive Author
  • Has been a member for 5-6 years
  • Referred between 10 and 49 users
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • Sold between 100 and 1 000 dollars
  • United States
theflyingtinman says
this is wrong, if(mc){ //on stage } else { // not on stage.. } this is right getChildIndex(DisplayObject);

Now we have people coming back and correcting their own 6-month old mistake (which was already irrelevant and 6 months late when first posted)! This is starting to feel like the Twilight Zone :O

8 posts
  • Bought between 1 and 9 items
  • Exclusive Author
  • Has been a member for 4-5 years
viaria says
this is wrong, if(mc){ //on stage } else { // not on stage.. } this is right getChildIndex(DisplayObject);
Now we have people coming back and correcting their own 6-month old mistake (which was already irrelevant and 6 months late when first posted)! This is starting to feel like the Twilight Zone :O

answer came 6 monts later and the main is not changed, there are people coming from google, they deserve answer.

6 posts
  • Bought between 10 and 49 items
  • Exclusive Author
  • Has been a member for 5-6 years
  • Sold between 1 000 and 5 000 dollars
pedropoc says

thanks a lot guys, very useful tip!

by
by
by
by
by