1 person found this helpful
I don't understand your explanation/issue. If you could outline steps to describe how you arrive at what you are having a problem with, then it might be easier to see what the issue is.
HI Johnnsen ,
I too don't understand your qusetion please make it clear.
Alright, I'm sorry, I will try to make it clearer. If you still don't understand, please tell me which part is unclear.
So, if I want to do a "gotoAndStop" for a movieclip inside another movieclip, I'd have to do it like this: "_root.movieclip1.movieclip2.gotoAndStop(2)" Right? This however, only works if the first movieclip has its instance name set correctly, which you can set here (Picture):
And this instance name stays set, as long as you keep it on the stage. Maybe try it. Pull something from the library on the stage, give it an instance name, and then delete it. When you get it from the library again, the instance name is gone. That means, whenever I attach a movieclip via actionscript, the instance name also seems to be gone, because any code that refers to nested movieclips doesn't get through, presumedly because the parents movieclip's instance name is empty again.
Here in short form what the problem is:
I want to attach a movieclip, and that movieclip's class should tell another movieclip nested in it to go to frame 2. That however only works if the movieclip1 containing movieclip2 gets added to the stage and gettings its instance name set manually. When attaching movieclip1 via code the "_root.movieclip1.movieclip2.gotoAndStop(2)" thing doesn't work, because apparently "movieclip1" (containing movieclip2) is "undefined".
I hope this made it clearer, I'm sure there is a stupid mistake there somewhere, apparently I don't set the instance name right when attaching the movie with AS2, I don't know. I can only use gotoAndStop on nested movieclips if the parent MC was added manually and having its instance name set.
The purpose of instance names is to be able to use the same library object numerous times and target each one separately.... an instance of this object here, an instance of this object there, etc... The instance name only applies to an object on the stage. A library object has no instance name until you assign it one while it is participating in the movie.
When you attach a movieclip using code in AS2, you should be using the attachMovie() method. Within that method's arguments is where you assign the instance name...
this.attachMovie(id, name, depth)
The 'name' argument is the instance name you code will use to target that instance. So inn your case you would use...
this.attachMovie(id, "movieclip1", ....)
I am intentionally only focusing on the instance name, the other arguments you hopefully know how to deal with
Yes, I do a attachMovie("movieclip1", "movieclip1", _root.getNextHighestDepth());
But then when I try to change the frame of a clip that is inside of movieclip1 with "_root.movieclip1.movieclip2.gotoAndStop(2)" nothing happens.
Thanks for making it clearer though, I had a bit of a wrong understanding of it. I think I figured it out now.
What is the ID supposed to be, assuming you want a clear setup of your code? Should it be the same as the name?
1 person found this helpful
The ID is the linkage ID you assign to the movieclip in the library -- it is the identifier you use to call that symbol onto the stage using code. If you right click the symbol in the library and select the Linkage option, that should open the interface where you assign the ID.
The ID has no relation to the name you assign. In fact, if you plan to attach lots of the same symbols using attachMovie, you can hopefully see where you might not want to have the name be the same as the ID. The ID is for the symbol, but the instance name is for a single unique instance of that symbol.
Thanks, that made it a lot clearer!