Turn A Combination Lock In AS2?
Hey, guys. I'm upgrading my portfolio with new graphics and flash navigation. I'm out of ideas to make a "combination lock" type of animation work using AS2.
I need a movie clip of a lock dial to move upwards or downwards based on button clicks. So far, I can only get the movie clip to move in forward order from A to B but not from B to A. I'm using a movie clip that goes to markers A to B to C and then to D. I need to make this clip move in a non-linear to each letter.
My AS skills are limited. I think I need to set a "current letter" variable and then have the animation move from this "current letter" point either up or down the number range based on the click. Do you guys have any ideas how to do this?
My source files are here: FLA (16mb), the SWF (1MB) and a zipped file (15mb) with both files.
Thank You, Problem Solved.
Thank you for such a precise answer. This SWF works great now. Greensock is a very nice app for Flash. It's simplified my task of complex coding down to knowing which frame I want to send the movie clip to.
I implemented your answer by placing all the code in the first frame of the main timeline and referring to each button instance (btn1,btn2, btn3...) to drive the clip.
Quote:
import com.greensock.TweenLite;
import com.greensock.plugins.*;
TweenPlugin.activate([FramePlugin]);
function updatePosition(number) {
TweenLite.to(windmill_mc,1,{frame:number});
}
this.btn_1.onRelease = function() {
_root.updatePosition(1); //refers to the A position of the windmill movie clip
};
this.btn_2.onRelease = function() {
_root.updatePosition(26); //refers to the B position of the windmill movie clip
};
this.btn_3.onRelease = function() {
_root.updatePosition(47); //refers to the C position of the windmill movie clip
};
this.btn_4.onRelease = function() {
_root.updatePosition(71); //refers to the D position of the windmill movie clip
};
Thanks, again.