Hi,
Ok I have a flash movie with a graphic that I want to move vertically, then horizontally…
I am using the following actionscript:
[AS]
// Fade and Position
MovieClip.prototype.fadeposition = function(endX, endY, endALPHA, speed){
// starting alpha
this._alpha = 0;
// perform actions when frame is entered
this.onEnterFrame = function(){
// fade in
this._alpha += (endALPHA - this._alpha) / speed;
// enlarge x value
this._x += (endX - this._x) / speed;
// enlarge y value
this._y += (endY - this._y) / speed;
}
}
[/AS]
I call the above on frame 1 by using the following:
[AS]
// move image
mc_imgdiamond.fadeposition(365, 300, 100, 100);
[/AS]
I then have another ActionScript function that moves the movieclip horizontally:
[AS]
// Position
MovieClip.prototype.pos = function(endX, endY, speed){
// perform actions when frame is entered
this.onEnterFrame = function(){
// enlarge x value
this._x += (endX - this._x) / speed;
// enlarge y value
this._y += (endY - this._y) / speed;
}
}
[/AS]
Now the next line of code I have on frame 2, I would have thought the following ActionScript would have worked to see if the movieclip’s _x value had reached 300 or not:
[AS]
if (mc_imgdiamond._x == 300) {
// move image
mc_imgdiamond.pos(150, 300, 5);
// delay next frame
my_interval = setInterval(unpause, 3000);
}
stop();
[/AS]
However, nothing happens. Any ideas? Am I calling the “_x” value incorrectly?
Cheers,
Chris