Ok, so I have a button (called “MC_Star”) that can be dragged around, and when a certain other button is clicked, I want MC_Star to go from wherever it is to the top center, just out of frame. What I have now only allows it to move relative to where it is. Here’s the code:
//Enterframes
MC_Star.onLoad = function(){
easeSpeed = 0; // the higher, the slower
target_xscale = target_yscale=100; // start at a scale of 100%
};
MC_Star.onEnterFrame = function(){
_xscale += (target_xscale - _xscale)/easeSpeed;
_yscale += (target_yscale - _yscale)/easeSpeed;
};
//Functions
MovieClip.prototype.mfade = function(prop, de, rem) {
this.onEnterFrame = function() {
for (i in prop) {
this* += (prop*-this*)/de;
}
};
};
MovieClip.prototype.aligncenter = function() {
this.xt = Math.round(Stage.width/2-this._width/2);
this.yt = Math.round(Stage.height/2-this._height/2) - 350;
this.mfade({_x:this.xt, _y:this.yt}, 5);
};
MovieClip.prototype.stageresizealign = function(listenername) {
this
[listenername] = new Object();
this
[listenername].clip = this;
this
[listenername].onResize = function() {
this.clip.aligncenter();
};
Stage.addListener(this
[listenername]);
};
MC_Star.aligncenter();
MC_Star.stageresizealign("MC_Star");
stop();
I think I know WHERE the problem is, I’m just not sure how to make it do what I want. In the Functions section, MovieClip.prototype.aligncenter is what gives the location.
I thought by checking for the center of the stage, then telling the y to go up 350 pixels (WELL more than half the height of the stage), it would work, but rather the star simply moves over and up relative to its original position, not wherever its been dragged to.
How might I tell the star to go to a position on the stage, not relative to where it is or was?