Can anyone give me a code in actionscript to make any sort of animation while opening this button

Can anyone give me a code in actionscript to make any sort of animation while opening this button & im using actionscript 1.0 & 2.0
Ayman_fmaAsked:
Who is Participating?
 
blue-genieCommented:
dude!!! you're publishing for Flash Player 6, Actionscript 1.
the tween class is not supported.
please change to at least Flash Player 7 and Actionscript 2.
0
 
Ayman_fmaAuthor Commented:
Can anyone give me a code in actionscript to make any sort of animation while opening this "frame "
0
 
Jen0910Commented:
http://www.republicofcode.com/tutorials/flash/tweenclasseasing/

You could add something like this directly to the frame:

import mx.transitions.Tween;
import mx.transitions.easing.*

var myHoriTween:Tween = new Tween (myBall_mc,"_x",Bounce.easeOut,100,500,4,true);

Open in new window

0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
Ayman_fmaAuthor Commented:
I use this code to open the frame:

btn_1.onRelease = function() {
      main_1.gotoAndStop(2);
}

I need a code in actionscript to make any kind of movement reaveling frame "2"
0
 
Jen0910Commented:
I gave you tween animation code, can you elaborate on what you are trying to move???
0
 
Ayman_fmaAuthor Commented:
Thanks jen I create abutton and i used this code   :

btn_1.onRelease = function() {
      main_1.gotoAndStop(2);
}

to reach specific frame in another movieclip called "main_1" I wanna to create any kind of animation while this freme shows on the stage
0
 
blue-genieCommented:
ayman_fma - what exactly are you trying to achieve?
0
 
Ayman_fmaAuthor Commented:
I create abutton and i used this code   :

btn_1.onRelease = function() {
      main_1.gotoAndStop(2);
}

to reach specific frame in another movieclip called "main_1" I wanna to create any kind of animation while this freme shows on the stage
0
 
blue-genieCommented:
are you wanting the animation in frame 2 of main_1?
so you press the button and it goes to frame 2 of main_1 where there's an animation?

will you upload your file - it might be easier to overcome the misunderstanding.
0
 
Ayman_fmaAuthor Commented:
Thanks Blue-genie

Do you still remind the "example" file that you created for me to open specific frame inside movie clip called "main_1" I want to make movement to this frame from”Left to Right ” when I click the button that called "btn".
0
 
blue-genieCommented:
Sorry i don't remember - i've helped with so many questions don't remember each one

I want to try and help you - but i don't understand what you mean by "movement to this frame from left to right."

is there an example of this somewhere so I can see what you're referring to?
i click the button.
main_1 goes to frame 2. what is inside frame 2? where must this move. what must move?

draw a picture if necessary.

0
 
Ayman_fmaAuthor Commented:
0
 
Ayman_fmaAuthor Commented:
Thanks Advanced "blue-genie"
I found this code in Action script tutorial & I want to use it but i don’t know how to modified to reach "frame 2 inside movie clip called main_1"

myButton_btn.onRelease = function() {
 tweenBall();
};
function tweenBall() {        
easeType = mx.transitions.easing.Bounce.easeOut;        
var begin = 20;        
var end = 380;        
var time = .5;        
var mc = ball_mc;        
ballTween = new mx.transitions.Tween(mc, "_x", easeType, begin, end, time, true);}

0
 
blue-genieCommented:
ok i remember this file now :-)

ok so, if i click a button you want the main_1 movieclip to tween(move) onto the stage from left to right.

see attached file.
i've moved the movieclip off stage.
i've used the tweenBall function as you wanted - just changed the parameters for where etc accordingly.

so currently when you click btn1 it will move the movieclip onto the stage.
you can create another function to move it off again if that's what you want to achieve.

you can then adjust the code as you need to to make it do what you want.
example-1-bgi-.fla
0
 
Ayman_fmaAuthor Commented:
Thanks blue-genie I tryed this:

function tweenMc() {
      trace("in tween");
      easeType = mx.transitions.easing.Bounce.easeOut;
      var begin = 350;
      var end = 200;
      var time = .5;
      var mc = main_1;
      ballTween = new mx.transitions.Tween(mc, "_x", easeType, begin, end, time, true);
}

btn_2.onRelease = function() {
      tweenMc();
      main_1.gotoAndStop(2);

};


its open the frame 2 but doesn’t make the animation
0
 
blue-genieCommented:
is this after you pressed btn_1?
the tween code moves the main_mc from off stage on stage.
if it's already there, then it won't do it again.


0
 
Ayman_fmaAuthor Commented:
yse after pressing btn_2 .
main_1 didnt move  even after changing the Begine & end
0
 
blue-genieCommented:
no you're not listening to what i'm saying. did you press btn 1 and then btn 2?

i'm going to explain the concept to you then you should be able to make this work any which way you want. There's not point me doing this for you because you'll never learn. once you understand it you'll realise how easy it is.

I'm referring to the file i uploaded

there is one function there that will move the movieclip from the begin position to the end position as specified by the variable. if you've already called the function i.e the movieclip is at the end position, it obviously won't move again.

if you want it to move off the stage and move back in each time. create another function, to do that, then call that reset function first before moving it -

but i think just understand what it is you're trying to achieve and understand what that code is doing - then play around with it.
0
 
Ayman_fmaAuthor Commented:
function tweenMc() {
      trace("in tween");
      easeType = mx.transitions.easing.Bounce.easeOut;
      var begin = 580.3;
      var end = -26.6;
      var time = .5;
      var mc = main_1;
      ballTween = new mx.transitions.Tween(mc, "_x", easeType, begin, end, time, true);
}

btn_2.onRelease = function() {
      tweenMc();
      main_1.gotoAndStop(2);

};
main_1 still in "var begin = 580.3;"  didnt move to "var end = -26.6;"
0
 
Ayman_fmaAuthor Commented:
maybe you miss understand me the first button in my project called btn_2 not btn_1
0
 
blue-genieCommented:
dude, the file you upload which i edited and reuploaded has a btn_1, then a btn_2
but what the button names are right now is irrelevant as we're trying to get to grips with the concept and understanding that.

reupload the file that you're referring to now that's not moving.
0
 
Ayman_fmaAuthor Commented:
0
 
Ayman_fmaAuthor Commented:
Blue -genie you r the best of the best.
Thanks Allot
0
 
Ayman_fmaAuthor Commented:
May I ask you another Question Realated to this
0
 
blue-genieCommented:
ask away i'll try and help.
0
 
Ayman_fmaAuthor Commented:
Thanks
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.