PDA

View Full Version : Continuous horizontal movement with AS?


mx-guest2004
06-23-2004, 07:49 AM
Hi!
Kirupa has a tutorial on continuous movement of clouds (motion tweening).
Does anybody know about a AS code for this kind of movement?
I know we can move the MC from A to B, but for continuous movement what is the condition if we get to a final point?

...
if (this._x <= 100) {
this._x += speed;
}
What is the code here if this._x IS 100? How get back to the start point? without sudden jump in the movie?


Thanks,
mx-guest2004 :)

baby_annie
06-23-2004, 09:38 AM
Try to search the "infinite menu" tutorial by POM at Kirupa. You will find the answer. :)

mx-guest2004
06-23-2004, 11:08 AM
baby annie,
I want a moving background image. Motion i one direction. Pom uses a mask at the end of his tutorial. Is that the mask which "hide" the jump. You know, I tried that code without mask, but the sudden jump is still there (in my animation) .
mx-guest2004

baby_annie
06-23-2004, 03:27 PM
Yes, the mask hides the jump. So you can use the code with the layer mask, and it will work.

mx-guest2004
06-24-2004, 09:38 AM
You know, the problem was to flip the image horizontaly in Flash MX. I needed to flip the other part of the image to match withe the first one. This caused some problems at the contact point. I made my background image in photoshop (flipping there) and imported this new image as my BG in Flash and chose the strat and rnd points in AS. Now the background moves as it would. ;)
I haven't understand yet why this flipping caused problem in flash. I even changed the registration point of the flipped MC, but didn't help.
Now my animation works. May be spend some time to understand the problem.
One thing more : you don't need any mask to have the smooth moving bacground. Right chice of start and end points is the key.

mx-guest2004 :)

mx-guest2004
06-24-2004, 09:45 AM
It's me again,
and this code can be used to move the background by AS :

startPoint = _root.bg._x;
speed = 1;
_root.bg.onEnterFrame=function(){
if (this._x > ???) { //half of the whole BG image._width +- few pixels, check.
this._x += speed;
}else{
this._x = startPoint;
}
}

mx-guest2004