Movie clip question (long)

Greetings,

As a relative newcomer to Flash (5), I’ve been following the movie clip questions below, and thought I might take advantage of the intellectual/creative generosity here to pose my own question on a variant of this same theme: converting an existing animation to a movie clip for subsequent insertion in another movie.

I’ve created a small animation of a DOHC 4-stroke engine in cutaway view, which you can see here.

Please, just click through my splash page to see the flash animation.

According to what I’ve read here and elsewhere, I should be able to Edit/Select All (or control-click and drag) all of the layers and keyframes of my existing animation and convert them to a movie clip symbol by selecting that option in the dialogue, giving the clip a name, and finally pasting the copied layers/frames into the new symbol’s timeline.

Subsequently, I should be able to drag an instance of this newly created movie symbol back onto the stage and have it run within a single keyframe.

Alas, when I test the resultant movie, all I get is a blank screen with a static image of my engine popping briefly into view (1 frame out of the original 40.)

My intention is to add some simple bells and whistles to the engine animation such as start/stop, display components, history of the reciprocating engine, and so on, so I’d like to be able to encapsulate the existing animation into a movie clip to better control the flow of information and enhance the user’s experience.

The engine itself was built from the ground up, using static images from an encyclopedia as the reference. As I created the various components, I converted them to symbols, deleted the original from the stage, and dragged the symbols back onto the stage, bit by bit, to build the engine. I then (rather laboriously) set the parts into motion, added the gasses, sparks, cam and crank motions and so on to create the finished product you see if you follow the link above.

So, I suspect I am going astray somewhere in this process, and would appreciate the comments and assistance of the kind experts who haunt this excellent website. Since I can be rather thick-headed at times when dealing with new processes, I would especially appreciate a step-by-step guide to the selection, conversion to a movie-clip symbol, and insertion into a (new) movie of an existing animation, as described above.

Thanks very much,
sp

A) really nice engine animation. I like a lot. Very well done sir.

B) you’re right, you’re off just a little bit… but close.

What you want to do is this:

Open your FLA with the full animation in it.

Find all the frames, on all the layers, that you would like to include in the animation, and make sure that the layers are together. That is, if you want something excluded from the animation, then drag that layer to the bottom or the top, so that you wont select it with all the other frames.

Near the end of the timeline somewhere. Click on an empty frame and drag the mouse so that you have all of the frames you want selected. Release the mouse button. Everything you selected should be highlighted.

Using Ctrl+Alt+C will copy all the frames.

Use menu option “Insert/Create New symbol”

In the dialogue box that opens select movieclip, and give it a name for the library.

A new blank timeline will open up for editing of this symbol.

Now simply select the first frame of layer one and hit Ctrl+Alt+V to paste all the frames there.

The full symbol is now in your library.

I like using this method, but there is something to watch about it. Any layers which do not have frames extending to the end of the animation, will fill in frames to the end. You may have to go to the end of the frames then and edit out some of them.

Thank you very much, kind sir, for your generous comments and expert help.

I had simply overlooked the small, but extremely critical, distinction between merely cutting and pasting, and cutting and pasting FRAMES, which makes all the difference in this case.

I feel especially sheepish about my oversight here because I have neglected my own advice, i.e. when learning, it is best to use the menu choices rather than relying on keyboard shortcuts. Had I done so, I might have noticed the two sets of copy/paste choices, and the light may have gone on. As it was, I thrashed about for a couple days before finally coming here for help. Alas.

Thanks too for anticipating an attendant problem with this method and pointing out that short sequences on the various layers extend themselves to the final frame on the symbol timeline, so some final tweaking is necessary (in the case of my particular animation) once it has been converted into a movie clip symbol.

I notice also that when I bring all 34(!) layers of my animation into the library as you have described, I lose all of my layer names, and when I use the control>test scene option in the library, the symbol is pushed off the upper left hand corner and 3/4 obscured, so this will make testing in the library environment a little more difficult, but not impossible. I imagine there is some remedy for this, and I’ll try to figure that out presently, but first I have to turn around from this little laptop and its 1024x768 resolution and carry on at my workstation which is running at 1600x1200 and offers a much more comfortable and expansive environment for Flash and 34 layer symbols!

Thanks again and best wishes,
sp

I try to make everything into a movie clip from the get go… but always we run into problems where we thought that something would work better one way and then had to switch over to a movie clip.

The reason that it is offset to up and left is that the centerpoint of the stage relative to the elements on it, when placed in a movieclip, is the upper left corner of that movie clip. Usually this is not too problematic as you can place a movie clip where ever you like, manualy setting the object where you wanted it in the first place. Another option is to embed that movie clip inside another movie clip, offsetting it in there so that the main movie clip is correct.

Sometimes neither of these options works just right and I have to go in and edit all my tweens and such. There is an option for editing multiple frames using the onion skin. This works only on one layer at a time though, as far as I know. It’s tedious but sometimes necessary.

Funny about those menu options. I almost always spell out the menu structure to command in my posts, but for some reason I didn’t with you. Silly me… glad you were able to figure that out anyway.

I’m a little surprised that you lose layer names. I could have sworn that they carried with the frames to the movie clip’s timeline. I’m going to have to see why that is.

Hi again,

I continuing work with my engine animation, I’ve added a short introduction which brings the viewer to a static page with some general intro info on the history of the four stroke, along with a reduced static image of the engine symbol.

I’ve added two buttons here, one of which takes you to another set of static frames calling out the various engine components (spark plug, etc), while a second button attempts to run the engine movie clip from an isolated keyframe, where it sits all by its lonesome.

At first, I just tried having my ‘run’ button (goto and play) the isolated keyframe where the movie clip sits on its own layer, but that didn’t work, and my movie kept looping around back to the beginning, with the movie clip just flashing briefly into view.

I then took another look at some of your posts and Kirupa’s (Best of, Tutorials) on movie clips, and decided to give the TellTarget action a go, even though I realize that particluar action is being de-emphasized in versions 5 forward, so I was hesitating to devote much effort to it. Anyway…The current problem is that now the output box is telling me -Target not found “.EngineRun”

My ‘Run’ button object actionscript looks like this:

on (release) {
TellTarget (".EngineRun") {
gotoAndPlay (1);
}
}

When I dragged an instance of the engine animation move clip onto the stage of the movie in question, I gave it the name EngineRun. I’ve tried it with and without the preceding dot (.) and also with a slash, but no dice in either case.

I know this movie clip works, because I can drag it from my library into a another new movie, and it works fine from the single frame.

Perhaps I am going about this all wrong as a result of my sketchy knowledge of Flash, in particular Action Script, which I have been hoping to defer to later, pending possible purchase of MX. I’ve worked with BASIC, POVRay, some JavaScript, and other scripts in the past, so I don’t think I’ll be totally inept in that realm, but first I’d like to get this engine demo running so I can go on to these other issues. A little knowledge CAN be dangerous, no doubt.

As presently constructed, the move consists of several layers and a series of keyframes on these layers. Maybe this structure is what is causing the problems as the various sections of the movie are in some cases separated by essentially blank frames, and the main sequence (the engine animation clip) sits off by itself at the end of the timeline. I suppose this sort of structure is somewhat akin to the infamous ‘spaghetti code’ of BASIC, and I admit to it, but I always could get things to work this way, but perhaps not in Flash.

So, once again I request your kind assistance in sorting this out. Any ideas?

thanks,
sp

I haven’t read you’re whole post here… I’ll do so once I get into work and have a little more time… I can let you know though that there is a shorter version of the tell target

on (release) {
EngineRun.gotoAndPlay (1);
}

This is still tellTarget, but it requires none of the extras.

The way this works is easy.

gotoAndPlay(); is a method of any movie clip. That is to say… all movie clips can be told to play, stop, gotoAndPlay, or gotoAndStop… as well as many other things. With dot syntax all we do is call to the movie clip first, then make a dot, then make the method we need.

Yes, thanks. I saw that in one of your other posts (Best of Forum) here and tried that syntax too, but that isn’t working either. It just sits there.

If you go back <a href=http://www.angelfire.com/on2/splinx">HERE</a> to my page, like before, and click on the little golden motif to the right of my name under the flash animation you saw before, you’ll be taken to the semi-functioning movie I described in my long-winded post above, and have an idea of what I’m trying to accomplish.

You’ll notice that there are two other incarnations of the engine in static poses. I copied this from the movie clip and pasted back into the stage, and then reconverted it to a graphic symbol for use in the two places you see. I wonder if I’m causing myself problems somewhere in this process, and that accounts for the “target not found” errors I mentioned using the Flash 4 tellTarget syntax.

(Come to think of it, the version up there now doesn’t have the static engine images converted back to symbols, but others I’m working with do, and it doesn’t appear to make any difference – except in file size)

I’m also beginning to think that I should be using scenes here rather than attempting to jump around on the timeline in various layers, but everything I’ve read says that what I’m trying here should work, so there’s probably some basic error in my reasoning lurking in there somewhere, or I’ve gotten the parser confused.

Having gotten frustrated with this course of action, I’ve gone on to Plan B for the time being, which I’ll upload perhaps this evening (California time) so you can see it by clicking on the motif to the left of my name. This is primarily a test just to make sure I’m not totally screwed up. Sure enough, it seems to work OK.

Well, sorry to go on and on like this, but I really appreciate your help and I prefer to try to spell things out as comprehensively as possible, but sometimes I think it’s just too much. ;o)

I could send you the FLA if that would simply this process. Let me know and thanks again.

sp

Ok, I think I’ve figured out where I was going astray, at least with the goto frame aspect of this.

I put a stop action on the frame where the movie clip resides, and added ‘run’ and ‘stop’ action buttons within the movie clip itself, as well as a ‘stop’ action on its first frame, and then have it loop back to frame 2 within the movie clip, and this at least allows me to access the animated engine independently.

I’ll post this bit on that left motif later today.

I suppose it’s a bit of a kludge, but at least it gets me beyond that problem so I can go on. I’ll try to tackle the problems with “target not found” and the Flash 5 tellTarget option in a bit.

sp

I think I see one problem… and it’s explination may help in two areas.

This is a section of a post I made for “The best of Kirupa” called “my first movie” or something like that. Read this first, then I’ll go into how this can help you in two ways.

This is related to an example in which we have a ball movie clip which bounces up and down, and inside it, is a movie clip of the ball rotating in place.

The only thing that I wanted to add to the Movie clip stuff was this. Just because you named the movie clips as you created them, does not mean that you gave them “instance” names.

If for instance, your ballRotating movie clip had a stop(); action in the first frame, you’re ball would bounce up and down, as per the timeline of the ballUpNDown movie clip, but it would not rotate. Likewise you could put a stop action in the beginning of that movie clip as well. Since the movie clip ballRotating is inside the ballUpNDown movie clip, it would not be affected by that stop action, and vise versa.

So, lets say that you had a stop action on frame one of ballUpNDown, and one on frame one of ballRotating. If you did a test on the movie you would see the circle sitting there doing nothing. If you wanted to tell these movie clips to do things at various times, lets say by a button, then you would need to give each an “instance” name. The reason for this should be pretty easy to understand… because you could technicaly put three or four, or however many of these on the stage that you wanted… the Flash player wouldn’t know which to tell to do something unless it had a name to reference. That is where the instance panel comes into play.

Lets say that we gave each of our movie clips the same “instance” name, as it had in it’s library. So ballUpNDown, has an instance name of “ballUpNDown”, and ballRotating has an "instance name of “ballRotating”. Each one has a stop action in it’s first frame, AND there is a button on the main “Scene1” stage which we are going to use to make the ball start bobbing up and down, AND rotating.

The button would have a script like this

on(release){
ballUpNDown.play();
ballUpNDown.ballRotating.play();
}

these commands are called “tell targets”. As the name implies, they are telling a target movie clip to do something. In this case, to play.

you might be asking yourself, unless you’re really swift, or already familiar with dot syntax naming structures, why does the second tell target say “ballUpNDown.ballRotating”?

If you’ll remember the ballRotating movie clip is INSIDE the ballUpNDown movie clip. So when we call to it, we need to call first to the movie clip which is on the main timeline, and then add a period, and then the name of the movie clip that is inside of it.

open the library, and take a copy of ballRotating and place it one the stage next to the other ball. Give it an instance name of “ball2”.

now we can call to ball2 directly to make it rotate. Since it is not inside a “ballUpNDown” movie clip, you can’t make this one bounce though.

confused yet? I was at this point.

the point is, you could create a movie clip called “Man” which has in it a five movie clips called “torso”, “armL” “armR” “legL” and “legR”. Each of these legs and arms can be set up with a tween to swing back and forth, but with a stop action on the begining of each of their timelines. Then “Man” movie clip which contains all of these can be set to tween from left to right across the screen.

Now, if you had actions set up correctly, you could have him walk, and swing his arms and legs appropriately, but ONLY while he’s walking. When he stops on the right side of the screen, you can have a commands which tell each of the limbs to stop moving.

The nice thing about this set up is, that the legs and arms will move with the “Man” movie clip as he goes along… so they don’t need to be tweened left to right… only in their swinging motion.

So, in your case, it’s probebly that you have not given your movie clips “Instance” names in the “Instance” panel. This panel is accessed with menu option “Window/Panel/Instance”. The text field in this panel is only accessable if you have a movie clip selected on the stage. (keep that in mind if you open it and find that the field is not letting you enter anything… it’s probebly because you don’t have anything which accepts an instance name, selected.)

Now the second way that this helps you is in the case of these static images that you are making of the engine. Just as you can pull multiple instances of a movie clip to the stage, there is nothing which says that any instance has to be a movie clip.

Try this as an experiment to give you an idea of what I’m talking about.

Drag your engine movie clip to the stage. Open the instance panel, and in the drop down menu of that panel, select “graphic” instead of movie clip. You will see a few options close (like the instance name since graphics can’t have instance names in Flash 5.) and you’ll see a couple of others open up. There should be an option there which lets you set “single frame” and then lets you set the frame number. If you set any number in here it will display this instance of the movie clip as a static image at the frame number you set.

This is very useful, as it doesn’t add anything to your library… it’s using the same symbol over and over again. This helps a lot in download time when counting k.

I hope this answers your questions… but feel free to ask more if you need.

I forgot something.

often you’ll see “_root” or “_parent” in a tellTarget. These are global names which refer to the main timeline, in the case of _root, and the timeline which contains whatever it is that calls the action in the case of _parent

So, if you had a button inside your engine, which was supposed to tell the engine itself to stop, you would only need to write it like this

on(release){
stop();
}

but if you had a button in the engine movie clip and you wanted it to tell the main timeline to stop you’d need to write it like this.

on(release){
_root.stop();
}

This is a useful tool because sometimes you’ll have a situation like this.

on the main timeline you have a movie clip with an instance name of “myMovieClip”, inside it, you have two movie clips called “myChildMovieClip1”, and “myChildMovieClip2”. Inside the second child movie clip you have a button which tells the first child to do something like play(); The button would have script like this

on(release){
_parent.myChildMovieClip1.play();
}

You could just as easily write this like this:

on(release){
_root.myMovieClip.myChildMovieClip1.play();
}

both would do the same thing. It’s just a matter of where you are directing the attention of the Flash player when making a tellTarget.
Most of the time I prefer to use _parent. The reason is this: If I were to change my movie later, by say, taking all the frames in all the layers on the main timeline, copying and pasting them into a new movie clip as we did with your engine in the first place, then the action script might have to be changed on many buttons that I had in place, IF I had used the _root method. However, if I used _parent, then nothing would have to be changed. It’s really just a matter of working backwards through the chain of objects or forwards… but it’s something for you to consider for the future.

Yes, thank you. All of this makes sense.

Even though I have to strip away some elements of my engine in their two static instances, that creates no problems as long as I don’t try to group what’s left after making these modifications, i.e. they remain graphic symbol instances of the original movie clip, as you have suggested.

Anyway, that works out well since these static elements, now graphic symbols, are isolated on their own layer(s), and I’m not fooling with them once they’re back on the stage - they just need to sit there trying to look pretty.

Where I am still having frustrations is in trying to find my movie clip symbol with tellTarget.

I’ve read your posts in the “Best of” forums, and I understand the theory and practice of giving names to instances of movie clips so that Flash can address them individually. I also understand the concept behind having one movie clip nested within another, as your bouncing/rotating ball post/tutorial demonstrates quite well. I’ve worked through this a couple of times with success.

Nevertheless, I still can’t quite manage to get the tellTarget action to find my movie clip. I’ll post this current version at my site under the left motif this evening, barring a complete collapse after dinner like last night. (Well, I did stay awake through Fahrenheit 451…).

Now everything is working properly except the run button on the parts page, where I’m trying the tellTarget method.

The intro run button on the history page uses a simple goto frame, and I still need to finesse my buttons and some other fine-tuning, but…

To backtrack a bit, I see now that I was sloppy when I created the original engine in that I dragged a lot of parts back onto the stage without paying attention that they were by default being made into Movie clips. MM should change that.

Anyway, when I finally got myself straightened out on creating the movie clip, with your big help, I simply dragged all the selected frames into the library of a new symbol in a new movie, and started building the intro/front end to the project.

Now, when I look at the movie explorer, some of the individual elements of the engine are still being identified as movie clips. I’ve spent hours trying to straighten that out with limited success, as some items are grouped with others, without ever having been symbolized, so perhaps that tangle is creating problems.

In any event, I’ve called the entire engine EngineFrames when I made it into a movie clip, and I’ve given it the instance name EngineRun2 for the movie clip instance sitting on the stage. I’ve added stop and run buttons to the symbol itself within the library, and added a back button on another layer to the movie clip instance sitting on my frame 37.

As I note, the goto frame 37 button works fine from the history page, and all three buttons (stop, run, back) work as expected, except I probably should call it pause rather than stop. I also removed the stop action from frame 1 of the movie clip since that configuration required hitting start twice, so to speak.

Well, I’ve been at this all day, and I’m stumped on the tellTarget part of it.

My action script for the run button on the parts page looks like this:

On (release) {
EngineRun2.play();
}

The instance of EngineFrames sitting on frame 37, when selected, shows these three lines in the instance panel:

EngineFrames
behavior:Move Clip
name: EngineRun2

All of this very educational, of course, and even thrashing away at something with little success gives me a better feel for how Flash “thinks,” which will be valuable in the long run. Oh, I did try various combinations of _parent, _root, and even _child, also to no avail,and I always try to remember to use Flash’s built-in syntax checker, just in case.

So now, once again, oh kind sage of kirupa.com, I turn to you for your wise council.

sp

If that didn’t solve it, you better send me the FLA file. I’ll take a look and see if I can decypher.

[email protected]

I’ll send it along presently. My email has been down for the last hour

:x

I think that you have to resend it. For some reason I can’t open that file.

Just checking to verify that you did indeed receive my 2nd send of the 131k FLA file…
:cool:
sp

ok… got to wait till I get home from work though. I’ll check it out in the morning. :slight_smile:

Thanks. 'Hope it doesn’t drive you 'round the bend.

cya
:cool:
sp

For what it’s worth, I may go back and redo this project later, as time allows. I would certainly change the way I created and organized some of the moving parts, especially the cams and valves.

For now, however, the animation works reasonably well and does what it’s supposed to do. I’ve been getting some pretty good feedback about it, both directly from Industrial Tech students who’ve seen it, and also indirectly in the form of massive but unsuccessful gnutella assaults on my machine looking, I assume, for the fla file.

I wonder if you have had any insights, or any further comments about the tellTarget issue with this project. If not, please don’t feel obligated to spend any more time on it. As I say, I recognize some poor choices in the way I went about this project, and I may return to it later armed with a better understanding of Flash, and re-do the whole thing.

Thanx
:cool:
sp