Changing symbol and every instance of it at once

This is what I have:
I have a variable called “framenumber” and a movieclip(drawing) with six frames. Each frame of the movieclip has another drawing in it.
In the main movie, this movieclip exists over several frames and keyframes. I even do a motion tween with the clip. Now what I want to do, is change the value of framenumber (for example 2) and then do a drawing.gotoandstop(framenumber). So then, the drawing in frame 2 of the movieclip should be shown. But here comes the problem. If I do that,the drawing (in frame 2 of the movieclip) only appears in the frame of the main movie where I put the drawing.gotoandstop(framenumber) command. But in the other frames of the main movie, the initial drawing is kept. How can I let the drawing change everywhere where the movieclip exists?

So actually I want to know how I can change every instance of a movieclip, no matter where it is in the movie. Or maybe there’s a way to change the (library) symbol itself, so that every instance of it changes along with the library symbol?

I hope you guys can help me!

you could try putting this code in the first frame actions of the MovieClip:


i think it should work. =)

Of course you can change every instance of a movieclip, no matter where it is in the movie as long as it exists on its parent timeline when you use the command that’s going to make the change.

Note that an instance of the same symbol with different name won’t be changed

It looks to me like the different instances of your MC don’t have the same instance name.

Owkaayy, It works, but I don’t really understand it:crazy:. Something really weird happened by the way. I just copied your piece of code into the movieclip, and I hadn’t defined or declared frameNumber anywhere in the file yet. But when I published it, it automatically went to the second frame of the movieclip… Why???

And why does it change immediately after the ‘framenumber’ is changed? Does the movieclip automatically check the variable??

Actually, I wanted to wait with the change until frame 25, by putting a command there that changes the frame of the movieclip to ‘framenumber’.
But now the movieclip changes immediately after I push the button(frame14) that changes the variable. How can I work according to what I had in mind?

I feel like I’m being very demanding… So don’t understand me wrong, I am véry gratefull for the tips!!=)

ok now i’m confused. :stuck_out_tongue:

try this:

if (_parent._currentframe == 25) this.gotoAndStop(_parent.frameNumber);

if that doesn’t solve the problem, could you attach your FLA? :slight_smile:

Plas, plas, plas, Kax campeon!

Here’s the fla.
It worked without the “if frame 25…” statement. But now it doesn’t. I think it might have to do with the stop() I put in the movieclip. If I don’t put it there the movieclip plays, and it shouldn’t, but If I put it there, nothing happens. Well, you can see it yourself now:)

Maybe I’ll just put my site online? Then I can more easily explain what I mean, and you will more easily understand if you see it…


Yes plz

Okay, I published the swf on a webserver. So now you can go and watch it. When you come at the site you will see ‘music’ in big blue, alpha letters behind all the content. This is the movieclip where I’m talking about. Now, when you push one of the buttons to the right, you will see the 2 outer panes move away and you will see that the movieclip has changed and goes away to.
But what I want is that is doesn’t change until it’s outside the screen and after that is has to come back, changed.
This is how it is now:
If you push the gitaar-button, the movieclip changes from ‘music’ to ‘guitar’, goes away and then comes back.
This is how I want it:
If you push the button, the movieclip stays on music, goes away, changes and then comes back as ‘guitar’
The flash is also here, so maybe you can compare and find out how to do it??
Thanx!!! =)=)


PS: In the published swf, the if-suggestion from kax hasn’t been used yet, because then I have the stop()-problems etc…etc…

I’m sorry, the buttons are to the left, of course… OOPS! :slight_smile:

OK , I see what you mean.
I’ve had a look at your Fla and I’d separate things into MCs so everithing fits in one frame but with what you’ve got at the moment I would do something like this:

//code in buttons (I’m using gitaar as an example)
on (release) {;
this.onEnterFrame = function(){
if(this._currentframe == 13){//it would be better to label frames
doWhatYouneed(); //
this.onEnterFrame = undefined;



hope it helps


And how do I label frames? I used your script and I tried to use it for loading the movies too, but it doesn’t work, maybe because I didn’t label?

Kax, your last tip (if_parent 25…) seemed so logical because it worked without the if part, changing the mc immediately, but it doesn’t work with the if-part. Any ideas why it doesn’t?


I’m posting your original fla file with the example of gitaar working. Have a look and tell me if thatys what u want to achieve.


Well, the piece of code in ‘lettersclip’ doesn’t seem to work. I saw the trace you made. But the lettersclip (this is the movieclip where’s it’s all about) still comes back as music, instead of guitar.
Guitar is frame 2 of the lettersclip, so I want every instance to show their second frame…
Does it work the way I want it to with you? Maybe there’s something wrong here, some bug or something?

There you go!
I`d asumed you’d know how to do the rest


I searched for 15 minutes what you changed in the second one!:slight_smile: I didn’t see that the frame in the ifstatement was still on 14 in the first version. Guess I didn’t look good enough! But now it al works nice and smooothh owyeah!
Thank you very much, eki!!! =)

One last question: I always thought that ‘this’ referred to the object to which you assign the code, but here it seems to refer to the movie and not the gitaar-button. Why?


You are welcome!:slight_smile:

This refers to the object you’re working on or , in plain English,
the timeline you’re working on.
In this case note that the gitaar symbol is a button and as button it hasn’t got its own timeline so this refers to the timeline it is in.
If you where to use movieClip symbols rather than buttons(which I recommend but that’s another story) to refer to the main timeline you’d have to use 'this._parent ’ as ‘this’ would refer to the timeline within itself.

Hope it helps


:slight_smile: :slight_smile: