PDA

View Full Version : Okay, so how do you target an MC



bpdp
December 9th, 2008, 09:31 PM
geeze, been at it for 2 hours now. I have a movie clip on the time line with an instance name of clients. how do I target it?

I've tried a bunch of things but here is the latest:

MovieClip(root).getChildByName('clients').alpha = 1;this results in no errors but no changes in the alpha property.

Thanks for any help

Pherank
December 9th, 2008, 11:26 PM
An alpha value of "1" is equal to 100% - use a fractional number like .20

Also, do you need the reference to root? Is that an actual MC?

MovieClip(getChildByName('clients')).alpha = 0.20;

bpdp
December 10th, 2008, 12:26 AM
An alpha value of "1" is equal to 100% - use a fractional number like .20

Also, do you need the reference to root? Is that an actual MC?

MovieClip(getChildByName('clients')).alpha = 0.20;

Thanks Pherank,

Right, I figured out my problem... I was stupidly reseting my MovieClip back to .3 after I set it to 1. just the order in which I was calling my methods.

And yes the MovieClip(root) was not needed, thanks for the tip :)

===

I have one other question I am now trying to target a nested clip something like:

MovieClip(getChildByName('clients')).getChildByNam e('highlite').gotoAndPlay('over');
or
MovieClip(getChildByName('clients').getChildByName ('highlite')).gotoAndPlay('over');

none of these seem to work, can someone help me with the syntax on targeting a nested clip?

Pherank
December 10th, 2008, 01:10 AM
Can't you just call it directly?
MovieClip(getChildByName('highlite').gotoAndPlay(' over');

bpdp
December 10th, 2008, 09:15 AM
Thanks Again,

Using the code above I get:
Error #1009: Cannot access a property or method of a null object reference

Also I have multiple instances of "highlite" one in each navigational button. So I'm not sure that would work?.

bpdp
December 10th, 2008, 11:56 AM
Thanks Again,

Using the code above I get:
Error #1009: Cannot access a property or method of a null object reference

Also I have multiple instances of "highlite" one in each navigational button. So I'm not sure that would work?.

Got it - anyone else wondering:

var t:MovieClip = clients.getChildByName('highlite') as MovieClip
t.gotoAndPlay('over');