AS3: targetting nested movie clips
- Started
- Last post
- 8 Responses
- CyBrain
Doesn't seem possible the way it should be the way it was in the past: movieClip_mc.nestedMovieClip_mc...
So, I took out nestedMovieClip_mc and gave it a linkage name "idName" and exported it for actionscript in the library. Then, I wrote movieClip_mc.addChild(idName).x and got the error "Error #1010: A term is undefined and has no properties."
I even did trace(idName) and got object: [className I put in the linkage].
All I want to do is tell a nested movie clip to go to frame 2.
What would be a sensible workaround for this situation?
- mikotondria30
don't you need to define your nested movieclip (idName), as a 'new idName(); then add it to the nestedMc ?
- CyBrain0
This is the code I used.
var idName:ClassName = new ClassName();
movieClip_mc.addChild(idName);
- KarlFreeman0
Give this a bash:
var movieClip_mc:MovieClip = getChildByName("movieClip_mc) as MovieClip;
var ClassReference:Class = getDefinitionByName("idName") as Class;
var mcInLibrary:MovieClip = new ClassReference() as MovieClip;
movieClip_mc.addChild(mcInLibrar...
- thatblokemike0
trace(movieclip_mc.nested_mc.x) would definitely work so there was no need to take it out. must have been something wrong in the scope or your understanding of the setup.
movieClip_mc.addChild(idName).x
You say you placed the clip in the library with the linkage "idName" then you have called your instance the same name. This is incorrect. The library object should have the class name (blueprint) for your instance. you saying you have the actual words "ClassName" in your code? because that needs to be what you called it in the library. and your instance can be called whatever you like.
- CyBrain0
Thanks to everyone for the tips. I'll look into all the wisdom a little later. For this situation, I scrapped the nested movie clip altogether and just built out a timeline where I didn't need to resolve the issue.
Hey, I know the Flash gods hate to admit it, but sometimes timeline trumps code.
- KarlFreeman0
Hey, I know the Timeline gods hate to admit it, but most the time code trumps timeline. Let the battle begin....