michanagel
Technical User
Hi,
I have a problem here that I can't seem to figure out with my limited action script skills...
I have this picture which has the dimensions 5599x660 and it's kinda like a moving background, it's moving to the left.
Now, when it reaches the end I want it to be replaced by the same pic...
I came up with two possible options:
1. make a duplicate of the pic movieclip and place it on stage right behind the first one and then when the first one is off stage place it right behind the second one and so on...
2. have flash duplicate the pic automatically and place it right behind the original one (I read about that option somewhere I think it's called DuplicateMovieclip)
Now I tried to go with option #1:
Code:
var xspeed:Number = 20;
function moveLeft() {
if (this._x < -5600) {
this._x = 5998;
}
this._x -= xspeed;
}
img.onEnterFrame = moveLeft;
img2.onEnterFrame = moveLeft;
--> 'img2' is place right behind 'img' on stage
So here's the problem:
1. it works, but after the first round - it goes through image 1 (img) then through image 2 (img2) perfectly and then when it's supposed to place image 1 right behind image 2 there's a space of about 100 pixels between them... I don't know why because I gave the right x coordinates in the code...
2. now when u still go on and u go through (the misplaced) image 1 (img) and then u come to the point where it's supposed to place image 2 (img2) right behind image 1 there's also a space between them but only maybe of 5 pixels...
How come that with the same pictures with the same code for both of them it's doing something different both times ?
Any help is greatly appreciated and I thank u in advance for that !!
Regards,
Mike
I have a problem here that I can't seem to figure out with my limited action script skills...
I have this picture which has the dimensions 5599x660 and it's kinda like a moving background, it's moving to the left.
Now, when it reaches the end I want it to be replaced by the same pic...
I came up with two possible options:
1. make a duplicate of the pic movieclip and place it on stage right behind the first one and then when the first one is off stage place it right behind the second one and so on...
2. have flash duplicate the pic automatically and place it right behind the original one (I read about that option somewhere I think it's called DuplicateMovieclip)
Now I tried to go with option #1:
Code:
var xspeed:Number = 20;
function moveLeft() {
if (this._x < -5600) {
this._x = 5998;
}
this._x -= xspeed;
}
img.onEnterFrame = moveLeft;
img2.onEnterFrame = moveLeft;
--> 'img2' is place right behind 'img' on stage
So here's the problem:
1. it works, but after the first round - it goes through image 1 (img) then through image 2 (img2) perfectly and then when it's supposed to place image 1 right behind image 2 there's a space of about 100 pixels between them... I don't know why because I gave the right x coordinates in the code...
2. now when u still go on and u go through (the misplaced) image 1 (img) and then u come to the point where it's supposed to place image 2 (img2) right behind image 1 there's also a space between them but only maybe of 5 pixels...
How come that with the same pictures with the same code for both of them it's doing something different both times ?
Any help is greatly appreciated and I thank u in advance for that !!
Regards,
Mike