AS controlling a Flash Movie

I have created several Flash movies but can’t seem to controll it that well. Controlling means, separating the music loops, or mc loops from another mc, button, or graphic symbol motion tween…

For example: I have created a fish swimming in 1 layer. I have another layer with a ball falling. I would like to have that ball mc to stop after 1 loop. However, the fish continues to swim even after the ball has stopped… What AS statements, and how would I do this?

What are other techniques in controlling movies, making the mc delay or pause for certain amount of time then playing again… Additionally, any other types of control that would make a Flash movie more presentable.

For example: I have a Flash movie playing in its duration (15 secs), after that, the Flash movie loads the main movie in… What AS command or statement would create this functionality?

Thanks.

well the fish and the ball, each make them in a new movie clip and both place them on stage. I assume you’re tweening their motions, so at the last frame for the ball, put a stop sign in the AS box. Place them both on stage and it should work.

and the second example, on the last keyframe, use gotoAndPlay to load the movie (unless its a different swf). look in the flash help for more details on this.

I have changed the ball and the fish from graphic symbol to movie symbol but it still doesn’t work.

When put a stop on the last frame of the ball, it stops the whole movie instead of the ball mc itself. Why is that?

stop()

Make sure its in the movie clip, not the main timeline. It would be good to review the animation tutorials in Flash.

I have set a stop function in the desire mc. However, the mc that I really want to stop isn’t stopping. It continues to loop.

The other mc that stop only had one layer. The one that I want to stop has several layers in it. I have put a stop on the last frame of that mc layer. However, when I run the movie, it continues to loop. How can I resolve this issues? Thanks.

I have found out that by putting a MC inside a Mask, it affects the AS within that MC. Therefore, if I put a stop at the end of the MC for that movie inside the mask, it won’t stop but continues to loop. Once, I have pull that MC out of the mask, it stops.

Are there any way to get around that? My MC requires a mask to make the movie look presentable.

I’m not sure but i don’t think that should happen. Can we have a look at your file to see whats wrong?

Thanks, I have figured out the problem.

However, I have another problem with another movie that you might beable to help.

Let’s say I have a movie clip with a ball bouncing, but I would like to have that ball link or to call up a window.

For example: The ball is bouncing. An user clicks on the bouncing ball, then a window (made from motion tween) fades in.

How would I call it or link it? I have tried to call the window from a sub movie clip within the ball movie clip but the window follows the bouncing ball. When the ball bounce, the window bounce… How could I resolve this problem?

on the ball, use the on release code. So like:
on (release) {
do something with window
}

If youre gonna tween the fade in of the window, give it a frame label, and use gotoAndPlay to target your framelabel.

Yeh, that’s what I had in mind. I was thinking that I could call up the window from a separate Flash movie. Or I could call up the window from separate frames, like 50-60.

Should I call the on release on the main timeline or call it inside the ball mc? Moreover, should I keep the window movie clip inside the ball movie clip, or should I create a separate layer in the main timeline for the window. Then call the window from the ball layer (main timeline or inside the ball movie clip)?

call the on release on the ball mc for now, its easier. And the window movie clip should be seperate from the ball mc, not within the ball mc…

Hi Blah,

I have created the window in a separate movie clip, also placed it on a separate layer as well.

You can’t call an on release for a movie clip, only works for buttons.

I have given the first frame of the window layer a anchor name called info. I have tried calling it from the ball by using this, but doesn’t work.

Either way, if you have the windows movie clip in the same layer as the ball movie clip, or separate layers, the main timeline will go through all the frames. So how could I call it from one layer where the ball movie clip situates without playing the window movie clip on a separate or same layer?

Here’s the address to my fla. Feel free to fiddle around with it, this actually one of main action script I would use to do all my projects. Thanks for helping me out, I really appreciate it.

66.92.162.121/ga-210/audi2.fla

alrite i fixed it, but i can’t attach it its a bit big. Anywyas, ill tell you what i did.
First, i gave the window an instance name, on the main movieclip. THis istance name was called ‘window’. Then, on the main timeline again, i gave the ball this code…

[AS]
on (release) {
_root.window.gotoAndPlay (“window”)
}
[/AS]

thats it :slight_smile:

Hey Blah, I would like to thankyou for the help.

Rightnow, I’m trying to figure out how to only accept one click only. Meaning, the user can click on the ball to open the window then it he or she can’t click on the ball again to open it. At least, until the user hits the close button on the window. Other than that, it works fine. I can’t believe a simple as like that created problems for me.

no problem :slight_smile:
And for your second problem, i got it working, i had to use actionscript instead of tweening. I’ll explain anythin else if you don’t understand later :slight_smile:

Thanks Blah,

I actually see you replaced some of the tweens with AS. It makes the timeline a whole lot cleaner. I guess I could study the code a bit then rewrite my own. Do you know where I can find some tutorials on these type of AS that explains how to write AS that could control a movie, i.e. like the one you have wrote to replace minimum use of tweening?

Additionally, the ball only works after the first click. After the window opens then closes. The second click doesn’t open the window anymore. Why is that?

i just realized that, i’ll havta see why and i’ll get back to you. And for the tutorials, i dotn’ know any specific tutorials, but there are some in the tutorails>flash mx secton which may be helpful.

sorry i really can’t figure out whats wrong, but i 'll keep trying. I’ve noticed that sometimes the alpha only increases to half way. DOn’t kno why.

But if you look at the last keyframe on the ‘ball’ layer, once you remove taht, the alphaing is much smoother, but then the close button doesn’t work?! Any ideas…???

Hey Blah, thanks for trying… I’ll play around with it later. Once, I have figured it out. I could incorporate it throughout my whole movie.

When I have completed my movie, I"ll give you a glimpse.