This content has been marked as final. Show 4 replies
The clipName contains the name of the movieclip and not the path to the movieclip which would be _level0.myClip_mc. Just pass 'this' to the growClip function. See attached code.
Thanks very much for your help. Not being particularly adept at Actionscript (yet) it took me a little while to follow through the logic of it, but if I understand your code correctly the clipName variable is not needed at all -- the target_mc argument makes it redundant as long as the target is set up by giving 'this' to the growClip function.
Interesting stuff, although I'm sure it's completely basic -- the trouble with teaching yourself something as multi-layered as ActionScript is that you tend to learn it in piecemeal fashion and not with any logical progression. Anyway, one more snippet to add to my bucket of knowledge.
One last thing: the mc instances are scaling from the top left corner (hence the necessity for the extra script to reposition them so that they stay 'in place' as the resize). Is there a way using ActionScript to get them to resize (Tweening) from their centre rather than the corner? This would let me do away with the repositioning code entirely and would also solve one or two other things that are bothering me.
Can that be done?
The movieclip gets tweened from its registration point. Doubleclick the mc to edit in place. Examine the x and y in the property inspector -> in your case 0,0. Reposition the mc so that the registration point is in the middle of the mc -> if your square is 50x50 set x and y to -25. Go back to the main scene and reposition the mc to the original position. Now your square tweens from the center.
Wonderful, thanks LuigiL. I think I was getting my registration and transformation points confused. Also, I was looking for a way to reassign the registration point using AS rather than doing it in the timeline/stage. All is not working, thank you.