A Flash Developer Resource Site

Results 1 to 7 of 7

Thread: AS 2.0 - on(release) nextFrame() unless on last frame go to frame 1 ?

  1. #1
    Member
    Join Date
    Jan 2009
    Posts
    30

    AS 2.0 - on(release) nextFrame() unless on last frame go to frame 1 ?

    Hello I am having a bit of trouble. I have a left arrow and a right arrow and 6 frames each labeled "F1" - "F6" I would like it so after reaching #6 when pressing the right arrow it will go back to frame #1 again. Right now when frame 6 is reached it will stop forcing to use the back button as the only way to get back to #1 . I would like it to go from 6 - 1 again when clicked from frame 6.


    This is my arrow code for the right arrow. The left arrow is _root.prevFrame();

    PHP Code:
    this.onRelease = function() {
        
    _root.nextFrame();
    }; 

    This is what I was trying but was not working.

    PHP Code:
    on(release)
    {
        if(
    _root.currentframe lastFrame)
        
    _root.nextFrame()
        else
        
    _root.gotoAndStop("F1")

    any help would be appreciated.
    Sample attached. thanks!
    Attached Files Attached Files

  2. #2
    Senior Member
    Join Date
    Jul 2004
    Location
    outside Philly
    Posts
    154
    on(release)
    {
    lastFrame=6
    if(_root.currentframe < lastFrame)
    _root.nextFrame()
    else
    _root.gotoAndStop("F1")
    }

    or just put lastFrame=6 on the frame and use _root.lastFrame

  3. #3
    Member
    Join Date
    Jan 2009
    Posts
    30
    how would you write that. This is not working for me like this. Am I doing something wrong ?

    I have also tried this with no luck


    PHP Code:
    on (release) {
        if (
    _currentframe != _totalframes) {
            
    nextFrame();
        }else{
            
    gotoAndStop("F1");
        }

    Last edited by raine976; 09-03-2009 at 05:03 PM.

  4. #4
    Senior Member
    Join Date
    Jul 2004
    Location
    outside Philly
    Posts
    154
    if you save it as cs3 I will take a look

  5. #5
    Member
    Join Date
    Jan 2009
    Posts
    30
    Great. Here is CS3 version. I meant to save as this in the first place. Thanks for your help.
    Attached Files Attached Files

  6. #6
    Senior Member
    Join Date
    Jul 2004
    Location
    outside Philly
    Posts
    154
    Here you go check it out and let me know if you have any questions, there are a lot of ways to do it but this works.
    Attached Files Attached Files

  7. #7
    Member
    Join Date
    Jan 2009
    Posts
    30
    yes that works perfect. Thanks A lot!

Posting Permissions

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




Click Here to Expand Forum to Full Width

HTML5 Development Center