PDA

View Full Version : continuous looping image


phax
02-23-2002, 02:02 PM
I've got a rater long image (2560x157pixs) that I want to run continously in the background....


and since I want it to run smoth and slow the tween get's pretty long and the filesize pretty big!!


theres probably a better way to do this?.... I hope??


anyone?

jimburton
02-23-2002, 03:15 PM
Try this (http://www.actionscript.org/tutorials/beginner/Continuously_Looping_Background/index.shtml)

:)

phax
02-23-2002, 03:53 PM
that is exactly the way I've done it...

but since my image is so long and since i want it to run slow I have to make a much longer tween... and that makes the filesize to big.....


I was hoping there was another way of doing this?

jimburton
02-23-2002, 07:52 PM
Sorry phax, I thought that tutorial used a scripted method - whoops...here goes:

This is one way to do it. Export the bg clip by right clicking on it in the library, selecting linkage and calling it "bg", then put this code on the main timeline:


/////initialise
topDepth = 10;
stop();
//attach the first bg clip
_root.bgHolder.attachMovie("bg","bg"+topDepth,topDepth);
_root.bgHolder["bg"+topDepth]._y = 100;
_root.bgHolder["bg"+topDepth]._x = 0;
topDepth++;

function moveIt(clip) {
if (clip._x < 50 && !clip.attached) {
_root.bgHolder.attachMovie("bg","bg"+topDepth,topDepth);
_root.bgHolder["bg"+topDepth]._y = clip._y;
_root.bgHolder["bg"+topDepth]._x = clip._x+(clip._width-10);
clip.attached = true;
topDepth++;
} else if (clip._x < -1000) {
clip.removeMovieClip();
}
clip._x -= 10;
}


Then you need an empty mc called bgHolder on the bottom layer with the registration point in the top left corner. Nested inside the bg clip you need to put an empty mc with just one frame and put the code on it:


onClipEvent (enterFrame) {
_root.moveIt(_parent);
}

and on the first frame of the bg clip put the code attached=false; Don't put any instances of the bg clip on the stage - the code attaches and removes them all.

The bit's you'll need to tinker with in the moveIt() function to get it just right are the inital distance at which to attach another clip (just b4 the current one begins to show a gap and the point at which to remove it. You can make this dynamic by calculations involving the stage width and clipwidth if you can be bothered...

Hope this works for you,

edited 24/02 jb

phax
02-26-2002, 05:12 AM
Finaly worked it out!!


*** thnx***