-
Moving Objects With ActionScript
Hey,
I think this should be possible, but I have no clue how to do it. I am using regular Flash MX by the way. Here's what I'm trying to accomplish:
When you click a menu button, it will tell a movie clip to shink and then move off of the screen with an alpha transition. Once the clip is off the screen, I want to execute a simple gotoAndPlay .... but I don't want the gotoAndPlay to execute UNTIL the movie clip is off the screen. Is this even possible? Hope this makes sense. Thanks for your time.
-
Abandon all Hope
-
Kind of a side question on this, is there anyway to pause action script? To allow time for a movie clip to play or something like that?
-
Abandon all Hope
This is a nice example of controlling
movement with a button:
code: MovieClip.prototype.easeTo = function(tar, tarx, tary) {
this.onEnterFrame = function() {
this._xscale += (tar-this._xscale)/5;
this._yscale = this._xscale;
this._x += (tarx-this._x)/5;
this._y += (tary-this._y)/5;
if (this._x>tarx-1 && this._x<tarx+1 && this._y>tary-1 && this._y<tary+1) {
delete this.onEnterFrame;
}
};
};
btn.onRelease = function() {
box.easeTo(100, 250, 30 );
};
Make a button with the instance name "btn", and a MC with the instance name "box". See the magic!
Code was done by scotty at kirupaforum,
so he gets all the credit.
-
WOW. This is almost exactly what im looking for, the only adendum would be to have it alpha to 0 as it moves, and then goToAndPlay after the motion is done. As for the code, I have an idea what it does, but I'm not 100% sure.
-
Abandon all Hope
code: MovieClip.prototype.easeTo = function(tar, tarx, tary) {
this.onEnterFrame = function() {
this._xscale += (tar-this._xscale)/5;
this._yscale = this._xscale;
this._x += (tarx-this._x)/5;
this._y += (tary-this._y)/5;
if (this._x>tarx-1 && this._x<tarx+1 && this._y>tary-1 && this._y<tary+1) {
delete this.onEnterFrame;
}
};
};
btn.onRelease = function() {
fadeout(this);
box.easeTo(100, 250, 30 );
};
this.fadeout = function() {
box._alpha = 100;
this.onEnterFrame = function() {
this._alpha -= 3;
if (this._alpha<=1) {
this._alpha = 1;
}
};
};
Never use goToAndPlay, you have to find that out yourself...
-
The G5 SP
why no gotoandplay , and what to use instead?
-
Abandon all Hope
That was meant as: I never use...
What I always do is load swf's externally.
But I'll try to make something...
-
I came up with a solution. Thanks for the help Inflicted!
-
Abandon all Hope
That's the way Wopat55!
Find a good code, and alter it to
your own needs!!!
(you've seen my avatar, haven't you?!)
good luck
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|