CodingForums.com

CodingForums.com (http://www.codingforums.com/index.php)
-   Flash & ActionScript (http://www.codingforums.com/forumdisplay.php?f=52)
-   -   Button to increment frames (http://www.codingforums.com/showthread.php?t=222405)

Vizard-Coder 03-25-2011 07:29 PM

Button to increment frames
 
Hi there, I was just wondering how to create a button that increments the frames in the timeline, until a certain frame.

How can this be done?

stevehungry 03-25-2011 08:58 PM

create a number variable, increase it by 1 and then use goto that variable name.

Code:

var myNumber:Number = 1;

myNumber++;
gotoAndStop(myNumber);


if you want it to play until a certain frame then write stop(); on the frame you want to stop.


or is this what you meant?
Code:

var desiredNumber = 10
var myNumber = 1;
mybutton.onRelease = function() {
if (myNumber< desiredNumber) {
myNumber++;
gotoAndStop(myNumber);
}
}

this will only make it go to the next frame if the currentframe (starting at one) is less than the desired number.

Vizard-Coder 03-25-2011 09:00 PM

The button I am creating is a next button, so it will feature on multiple frames, I want a way to increment it on click, rather than having to write a piece of AS for each frame the button is clicked.

Any ideas how to do that?

stevehungry 03-25-2011 09:03 PM

you could write the code in the actions of the button, then simply paste the button on every frame.

Vizard-Coder 03-25-2011 09:31 PM

Thank you! Working now :D


All times are GMT +1. The time now is 03:06 AM.

Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.