Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Go to fm 2 of M

Status
Not open for further replies.

DogsOnString

Technical User
Sep 19, 2003
3
GB
I have a movie clip in the library. It has a stop action on the first fm. It is x fms long and has a "go to and play fm2" action on the last fm. The clip works fine and the
script is correct in the actualy mc.

I would like to place it on the stage in a fm and target it from a button on the main timeline.

Is it possible to tell the playhead to go to fm 2 of my mc on mouse out or over or whatever I choose ?

Also if I duplicate a movie clip frome whatever action I choose can I then target the duplicate movie clip and change properties of said duplicate from a button or actions on a frame ?

Thanks for any help. This is my first post. I hope that it is clear and to the point. It is just basicly a "are these two things possible ? kind of question.
Peter
 
Absolutely.

Drag your library clip to the main timeline and assign it an Instance Name (properties pallette). I will call it myClip for my example.

Create your button and drag it to the main timeline as well. You should also give it an instance name for example button1.

You already have your movie clip working the way you would like so lets just look at the button. Right click on the button and select actions. Add the following action to your button:

Code:
on(rollOver){
   this.myClip.gotoAndPlay(2);
}

You can accomplish the same thing by using the with action.

Code:
on(rollOver){
   with(this.myClip){
      gotoAndPlay(2);
   }
}

When duplicating a clip you add an instance name when you duplicate duplicateMovieClip(target, newname, depth)

An example would be
Code:
duplicateMovieClip("myClip","myClip2","2");

Then on your button for the new clip you would reference myClip2

Hope it helps.


Wow JT that almost looked like you knew what you were doing!
 
Thanks for the quick reply.
It did work; I can now target fms within my Movie Clips.Cheers. I tried for ages but could not target the second frame of the mc for some reason.
The duplicate mc is still a bit problematic.
Here is my code

on (release) {
duplicateMovieClip(_root.M1, M2, 2);
}
on (release) {
setProperty(_root.M2, _y, 20);
}

This duplicates the movie clip ok.
From another button I wish to target the duplicate mc only.
The instance name of that mc is as you can see M2.

I added this code to the second button.

on (release) {
setProperty(m2, _x, 100);
}

The entire Contents of the Stage moves to the new position instead of just the duplicate Mc (2) I did try a couple of alternatives but always with the same response.
Cheers again.
This forum is a valuable resource
Peter
 
The new name needs to be in quotes. The original name and level can also be in quotes, but is not required.

Code:
on (release) {
    duplicateMovieClip(_root.M1, "M2", 2);
}
on (release) {
    setProperty(_root.M2, _y, 20);
}

or

Code:
on(release){
   _root.M1.duplicateMovieClip("M2",2);
}

on(release){
   _root.M2._y = 20;
}

Both will accomplish the same thing (and there are even a couple of other ways to do it).

Hope it helps!

Wow JT that almost looked like you knew what you were doing!
 
Thanks
The target duplicate mc has been bugging...Nice to see just the MC respond.
Thanks and cheers
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top