Go Back   CodingForums.com > :: Client side development > Flash & ActionScript

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 03-25-2011, 07:29 PM   PM User | #1
Vizard-Coder
New Coder

 
Join Date: May 2010
Posts: 43
Thanks: 9
Thanked 0 Times in 0 Posts
Vizard-Coder is an unknown quantity at this point
Question 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?
Vizard-Coder is offline   Reply With Quote
Old 03-25-2011, 08:58 PM   PM User | #2
stevehungry
New Coder

 
Join Date: Mar 2011
Location: England
Posts: 28
Thanks: 0
Thanked 5 Times in 5 Posts
stevehungry is an unknown quantity at this point
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.

Last edited by stevehungry; 03-25-2011 at 09:01 PM..
stevehungry is offline   Reply With Quote
Old 03-25-2011, 09:00 PM   PM User | #3
Vizard-Coder
New Coder

 
Join Date: May 2010
Posts: 43
Thanks: 9
Thanked 0 Times in 0 Posts
Vizard-Coder is an unknown quantity at this point
Question

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?
Vizard-Coder is offline   Reply With Quote
Old 03-25-2011, 09:03 PM   PM User | #4
stevehungry
New Coder

 
Join Date: Mar 2011
Location: England
Posts: 28
Thanks: 0
Thanked 5 Times in 5 Posts
stevehungry is an unknown quantity at this point
you could write the code in the actions of the button, then simply paste the button on every frame.
stevehungry is offline   Reply With Quote
Users who have thanked stevehungry for this post:
Vizard-Coder (03-25-2011)
Old 03-25-2011, 09:31 PM   PM User | #5
Vizard-Coder
New Coder

 
Join Date: May 2010
Posts: 43
Thanks: 9
Thanked 0 Times in 0 Posts
Vizard-Coder is an unknown quantity at this point
Thank you! Working now
Vizard-Coder is offline   Reply With Quote
Reply

Bookmarks

Tags
actionscript, button, flash, frame, increment

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 12:08 PM.


Advertisement
Log in to turn off these ads.