Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Horizontal Image Scroll

Status
Not open for further replies.

TeamXposure

Technical User
Dec 7, 2005
1
US
Hello

Disclaimer: New to AS and would love any help you could provide ... thanks.

Description: I have 8 images which need to scroll horizontally in a project. As they scroll off the page I need them to reset and begin to scroll again when it is their turn.

I am using the following AS to move them across the canvas:

this.onEnterFrame = function() {
if (this.circle_mc._x < 550) {
this.circle_mc._x += 3;
}
if (this.square_mc._x < 550) {
this.square_mc._x += 3;
}

}

I obviously have no problem having them end off screen ... but how can I have them reset to the other side of the page and resume the above script?

Thanks again for any help ... if you need more information, please let me know.

-Scott
 
try this...

this.onEnterFrame = function() {
if (this.circle_mc._x < 550) {
this.circle_mc._x += 3;
} else {
this.circle_mc._x = this.circle_mc._x * -1;

//if the circle's x position is 550, then 550 * -1 = -550. or you can put a zero instead of a -1, whatever works for what youre doing

}
if (this.square_mc._x < 550) {
this.square_mc._x += 3;
} else {
this.square_mc._x = this.circle_mc * -1;

//same concept as above

}
}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top