Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New Coder
    Join Date
    May 2010
    Posts
    43
    Thanks
    9
    Thanked 0 Times in 0 Posts

    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?

  • #2
    New Coder
    Join Date
    Mar 2011
    Location
    England
    Posts
    29
    Thanks
    0
    Thanked 5 Times in 5 Posts
    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.

  • #3
    New Coder
    Join Date
    May 2010
    Posts
    43
    Thanks
    9
    Thanked 0 Times in 0 Posts

    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?

  • #4
    New Coder
    Join Date
    Mar 2011
    Location
    England
    Posts
    29
    Thanks
    0
    Thanked 5 Times in 5 Posts
    you could write the code in the actions of the button, then simply paste the button on every frame.

  • Users who have thanked stevehungry for this post:

    Vizard-Coder (03-25-2011)

  • #5
    New Coder
    Join Date
    May 2010
    Posts
    43
    Thanks
    9
    Thanked 0 Times in 0 Posts
    Thank you! Working now


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •