Movement with actionscript

Hi I’m a actionscriptin newbie and I’m tryin to create movement using actionscript (in a banner) I have read the tutorial on this site but it doesn’t quite help me enough!!
basically here’s a link to the fla of what I originally did using motion tweening but it’s a huge filesize!! With actionscript i can make it smaller - can’t I?!

http://intranet.mykindaplace.com/playroom/playroom_banner1.fla

I’ve got the first image to move from one position to the next but I don’t know how to carry on the movement…if I type in more co-ordinates it just twitches!!? this is what I’ve done so far!
onClipEvent (load) {
loop = 0;
this._x = 280;
this._y = 160;
}
onClipEvent (enterFrame) {
if (this._x>180) {
this._x += -3;
this._y += -2;
(stop);
} else if (this._x<280) {
this._x += 3;
this._y += 2;
}
}

I’d b so chuffed if anyone can help me as my work expect it done by tuesday?! :-\ thx in advance!!
See attached .fla for what I’m tryin to do!!

ok mate i have done a complet new code for you
it works hope you know how to use it…simple to understand:) :slight_smile:

Hey Zen, wow u made it look so simple! I had an idea moveTo was a 'way ’ of doing it but couldn’t work out how!!
I’ve pulled urs apart and got it to fade as well now!
Thx alot - am workin on it today - then off on holiday 2moro - at least I’ll b able to relax while I’m away! cheers mate! :slight_smile:

I’m usin the code but am wondering how to make it move smoothly…currently it divides the distance it has to trave
l by say 5 so it starts off fast and slows down, is there a way to make it travel at the same speed from one x,y co-ordinate to the next?
the code is like this currently;
onClipEvent (enterFrame) {
this._x += (_root.endX-this._x)/5;
// can change speed by dividing the 5;
this._y += (_root.endY-this._y)/5;
}

see wot i mean… ?!hey n thx again for ur help - anyone?! =)

If you need smoother animation, up the framerate.

constant frame rate eh…
oh ok
onClipEvent (enterFrame) {
if(this._x!=_root.endX)
{ if(this._x<_root.endX)
this._x++;
if(this._x>_root.endX)
this._x–;
}

if(this._y!=root.endY)
{
if(this._y<_root.endY)
this._y++;
if(this._y>_root.endY)
this._y–;
}
}

haven tested the code just writting for fun hope it works

You can also use setInterval to get smoother motion or fading without having to adjust your framerate. Check out my (I’m retrotron there) longer explanation of moving something with setInterval here:
http://flashkit.com/board/showthread.php?threadid=459515
I posted some examples of fading with onEnterFrame() and setInterval() on actionscript.org, but the site’s down for the moment, so I’ll have to post that link later (I know, I know, everybody hates links :)).

This link should take you to the examples of fading with actionscript I mentioned: