Actionscript problem

Hi guys!

I have a problem and I hope, that you will help me. I have attached my fla. file (its very simple one),so someone can show me,how to do it. Inside file are 2 buttons and 2 clips. Each button have his own clip.Inside each clip are 21 frames for slide in and out effect.Now,here is my problem:
I would like to learn,how to set the actions for this buttons and clips. I already know, how to set actions,that each button open his clip. But I cant set it, that the opossite clip will slide out first,if is already on scene. I hope, that you understand me, becouse my english is bad. Simply - If I click the button1,the clip1 must slide on scene but clip2 must slide of scene first, if its already on scene.
I have tryed with “if” actions something,but nothing works (I m new in actionscript)
Can anybody show me,how to do it?

TNX

okay… here’s the quick explanation.

You need to tell Flash that you have openened one of your animations. In order to do so, you can do the following:

  1. Set up variables on the main scene that establish whether or not a clip has played.

   krogplayed=no;
   kvadratplayed=no;

that is the way your flash movie should start.

Then, you could change the status of those variables when you press a button.


button1.Onpress=function(){

if(_root.kvadratplayed=="yes"){ //check status
_root.kvadrat.gotoandplay(12); //play the out animation
_root.kvadatplayed=no; //change status to no;
}
_root.krogplayed=yes; //change the status of current movie
 krog.gotoandplay(2);  //play the blue button animation

}


do the same (with appropriate changes) for your other button.

Have fun!

Inigo,Tnx for yours help. I have just one more question. How this code change, if I want,that one clip is closed,before another start?Now they replace each other in the same time.First one is in the middle of going out and the second is on his way in. How about,that I want first one totaly gone,then the second one entrance?

In that case you could check for the playhead to reach a certain frame. Once it reaches that frame, you can proceed with the code to play your movie.

you can check your reference and look for _currentframe

that will get you on the right track to one of the methods you could use to accomplish this. As always, there are other methods.

Good luck

ok, i tried this and i cannot get it to work. just nothing happens.

here is my fla file, look at second scen, in there there are two MC each need for the other to unload before playing. If i get these two to work, there are 5 others to add.

HELP ME

Hi,eric.

As you probably see from my writing in previus lines, I dont know much about actionscript. But now I finally got a solution for my problem, you can dll fla.file from me and I hope,that will help.It helped me. I have visit your page and I think,that is nice, most of all I see,that you know a lot of writing scripts. So it wount be a problem for you,to use script in my fla.file in yours project.
I hope, I help you with that. :slight_smile: