Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 02-13-2012, 10:25 AM   #1
American horizon
Senior Member
 
Join Date: Jun 2011
Posts: 165
Default Problem to iteract with nested MC

Hi
i've a mastermc with nested another mc that nest anoher mc

Then i've mastermc--->mc1--->mc2

I've to reach the second child of mc2 and change it alpha propriety, then i've wrote:

mastermc.getChildAt(mastermc.x/450).getChildAt(0).getChilAt(2).alpha=1

but when i launch the program flash give me error
#1061: Call to a possibly undefined method gotoAndStop through a reference with static type flash.displayisplayObject.

Why?
American horizon is offline   Reply With Quote
Old 02-13-2012, 12:10 PM   #2
sakthimani
Nothing Impossible
 
Join Date: May 2011
Location: India
Posts: 89
Default

try to give their name to specify

like
master_mc.child1_mc.child2_mc.alpha=1

hope it help
sakthimani is offline   Reply With Quote
Old 02-13-2012, 12:50 PM   #3
[afz]snickelfitz
Senior Member
 
[afz]snickelfitz's Avatar
 
Join Date: Dec 2011
Location: Tucson, AZ
Posts: 2,397
Default

You might try assigning those nested MovieClips to variables typed as MovieClips.
That way, the compiler will know that gotoAndStop() is a valid method.
[afz]snickelfitz is offline   Reply With Quote
Old 02-13-2012, 01:53 PM   #4
SanderSoulwax
Senior Member
 
Join Date: Sep 2010
Posts: 131
Default

mc1 probably doesn't have (min) three children?

sakthimani's suggestion would be best, but if you really want to use getChildAt, to prevent errors always count the number of children first.

ActionScript Code:
if (mc1.numChildren >= 2) { mc1.getChildAt(1); } else { trace("mc1 doesn't have 2 children or more, but he has " + mc1.numChildren + " children"); }

etc.
SanderSoulwax is offline   Reply With Quote
Old 02-13-2012, 03:41 PM   #5
American horizon
Senior Member
 
Join Date: Jun 2011
Posts: 165
Default

Quote:
Originally Posted by sakthimani View Post
try to give their name to specify

like
master_mc.child1_mc.child2_mc.alpha=1

hope it help
using the instances name works, but i need to use a generic syntax for adapt it to a lot of situations withiut wrote manually instances names
American horizon is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 11:22 AM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.