A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: [F8] Navigate to next or prev frame for presentation

  1. #1
    Junior Member
    Join Date
    Aug 2002
    Posts
    19

    Unhappy [F8] Navigate to next or prev frame for presentation

    Hi there,
    I'm getting really frustrated with writing code to accurately move forward 1 frame or backwards 1 frame depending on hitting the Up or Down keys... I've used a Listener with minimal success.

    I've managed to get it to progress and regress but if i return to the first frame from any prev. frame, things get wicked screwy and the file progresses out of order. Upon returning to frame 1, it will jump to odd numbers, then every 3rd number maybe... Its jacked up.

    I want to be able to go back to the first frame and continue again WITHOUT it altering the order/# of frames/whatever the heck its doing.

    Any help would be greatly appreciated!

    My crappy code:


    function gotoNextSlide() {
    nextFrame();
    }
    function gotoPreviousSlide() {
    prevFrame();
    }

    var myListener:Object = new Object();
    myListener.onKeyDown = function() {
    if (Key.getCode() == Key.DOWN) {
    gotoNextSlide();
    } else if (Key.getCode() == Key.UP) {
    gotoPreviousSlide();
    }
    };
    Key.addListener(myListener);

  2. #2
    Banned deepakflash's Avatar
    Join Date
    Aug 2007
    Location
    [Object not found]
    Posts
    1,160
    i used onKeyUp and works fine:
    PHP Code:
    function gotoNextSlide() {
        
    trace(_currentframe);
        
    nextFrame();
    }
    function 
    gotoPreviousSlide() {
        
    prevFrame();
        
    trace(_currentframe);
    }

    var 
    myListener:Object = new Object();
    myListener.onKeyUp = function() {
        if (
    Key.getCode() == 38) {        
            
    gotoNextSlide();
        }
        if (
    Key.getCode() == 40) {        
            
    gotoPreviousSlide();
        }
    };
    Key.addListener(myListener); 
    Also, in onKeyDown i did not find any trouble... It kept running through Next Or Previous frames on pressing the respective Keys and was very quick, but never skipped frames
    Last edited by deepakflash; 09-13-2008 at 10:58 AM.

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