Hey I’ve known about this for a while, but just today I was told it can reduce file size… this caught my eye as my current big project is getting to be a big fla… So how much can the file be reduced? And also, where do I learn this technique? I know some basic action script, if someone would point me in the way of a tutorial I’d be much appreciative.
I wouldnt call it tweening,i’d call it .asp movement
onClipEvent (enterFrame) {
_x+=10;
}
onClipEvent (enterFrame) {
_y+=10;
}
onClipEvent (enterFrame) {
_width+=10;
}
onClipEvent (enterFrame) {
_height+=10;
}
onClipEvent (enterFrame) {
_alpha-=10;
}
onClipEvent (enterFrame) {
_rotation+=10;
}
onClipEvent (enterFrame) {
_xscale+=10;
}
onClipEvent (enterFrame) {
_yscale+=10;
}
put each of these actions in seperate MC’s and watch the fun.asp movement
Ah yes, I see how that works… then to stop it I could create a loop that ends after however many frames I need… the only problem is that you don’t know where it ends up at… that leads to a lot of trial and error and testing.
At least I think so…
hmmm how much will that really reduce filesize?
no trial an error… or at least not much
something like this could help.
onClipEvent(enterFrame){
If(_x<200){
_x++;
}
}
Mind you this is not optimal. There are better ways of doing this… but not many so simple.
Mostly a/s is used to move things in regular patterns, rather than from point a to b.
It will reduce your file size a lot.
d’oh… sounds like I need to incorporate some…
But I shouldn’t be too worried… My file cannot be over 5MB… it’s currently 1MB published with all sound and I’m about half done.
Man I wish I had optimaze!
You can create a tweenTo function or prototype to do the job for you. Something I did based on Supra’s code:
MovieClip.prototype.tweenTo=function(x,y,speed){
var deltax=x-this._x;
var deltay=y-this._y;
var distance=Math.sqrt(deltax*deltax+deltay*deltay);
var norm=speed/distance;
var diffx=deltax*norm;
var diffy=deltay*norm;
if (distance>speed){
this._x+=diffx;
this._y+=diffy;
} else {
this._x=x;
this._y=y;
}
}
You can use that with any movie clip:
onClipEvent(enterFrame){
this.tweenTo(300,400);
}
pom :asian: