Monster Racer Rush
Select between 5 monster racers, upgrade your monster skill and win the competition!
4.18 / 5.00 3,534 ViewsBuild and Base
Build most powerful forces, unleash hordes of monster and control your soldiers!
3.80 / 5.00 4,200 ViewsI have a moveclip loop which makes these shapes pan across the screen continuously.
I used as2 to make the looping:
onClipEvent (load) {
looping.duplicateMovieClip("colours");
colours._x=looping._x+looping._width;
loopStartxthis._x
loopSpeed=5;
}
onClipEvent (enterFrame) {
if(_root.background.loopStart) {
this._x-=loopSpeed;
if(this._x<=(loopStartx-looping._width) ){
this._x=loopStartx=loopSpeed;
}
}
}
The loop works but I also need a pause and play button to stop the loop, any ideas of what the actionscript is?
Can you please upload a .FLA file of your file with Dumping Grounds (Newgrounds Upload - My Account->Dumping Grounds->Free File Upload) - and send a link to it, please? That way, it'd be easier, because then I know how your file looks, and can alter ;)
Hey Prid-Outing, this link shows the images that loop using the actionscript above, so any ideas how to pause and play the images?
oh wrong link, heres the flash file
Make the button you want, and give it this Actionscript:
on(press){
loopCheck = !loopCheck;
}
With this, we create a boolean variable called loopCheck, and when button is pressed, the opposite of the current value will be set. If the current value of loopCheck Boolean Variable is equals to FALSE, pressing the button will result in changing it to TRUE, and if you press again, it will change back to FALSE. After that, on the code you provided on your first post, add this in the onClipEvent(load) section of the code:
_root.loopCheck = true;
This will make the loop start right off when the SWF file is played. Change it to false, if you want the loop to be stopped when movie is played.
And in the onClipEvent(enterFrame) section of the code, change where it says, from:
if(_root.background.loopStart) {
to
if(_root.background.loopStart && _root.loopCheck == true) {
And that's it. You simply create a Boolean Variable (variable only containing two values, either FALSE or TRUE - and with that, you can change between the two values of the Boolean Variable, and make codes be executed if a specific Boolean Variable is equals to TRUE or FALSE) - Hope this helps you ;)
Thanks a lot, it worked exactly the way I wanted it to :)