Okay maybe its because I’ve been working on this all day and can’t think straight any longer but this seems like it should be really obvious and I’m getting frustrated that I can’t think of how to do it.
I have a movie clip sitting just off stage. When the file is first launched I want to record the x position of this movie clip in a variables, say startX. When a button is pressed (and there are several of these) I am using Voetsoejba’s easing code (brilliant) twice, once to move an MC just in the x direction (easeX):
(on the main timeline, whre movetxt and content are the two MCs)
//record initial positions
menux = movetxt._x;
menuy = movetxt._y;
_global.startX = getProperty(_root.content, _x);
_global.startY = getProperty(_root.content, _y);
MovieClip.prototype.easeX = function(to) {
this.onEnterFrame = function() {
this._x = to-(to-this._x)/1.3;
if (this._x>to-1 && this._x<to+1) {
delete this.onEnterFrame; }
};
};
and another to move another mc in both x and y directions (ease):
//also on main timeline
MovieClip.prototype.ease = function(x, y) {
this.onEnterFrame = function() {
this._x = x-(x-this._x)/1.3;
this._y = y-(y-this._y)/1.3;
if (this._x>x-1 && this._x<x+1 && this._y>y-1 && this._y<y+1) {
delete this.onEnterFrame;
this._x = x;
this._y = y;
}
};
};
on the button
on (release) {
//bunch of other stuff
_root.content.easeX(135.6);
_root.content.gotoAndPlay(2);
_root.content.holder.loadMovie("calendar.swf");
movetxt.ease(menux, menuy);
}
There is also, on the content box that eases in, a close button with this script to ease it back off the stage:
on(release){
_root.content.easeX(_global.startX);
_root.movetxt._visible = false;
_root.movetxt._x = menux;
_root.movetxt._y = menuy;
}
So here is what is happenning: first time you hit the button to load it works like a charm but when you hit the close button it eases mostly, but not all the way, off the screen. Hit a button again to bring back the content mc and it disappears completely. Hit it a third time and the content mc just appears in place where it should, it doesn’t ease.
So what is going on? What am I doing wrong? :*( Is all this blather too complicated to sort out without an fla?
thanks for any help!