dcsimg
A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: Backspace key

  1. #1
    Member
    Join Date
    Nov 2003
    Location
    Southampton, UK
    Posts
    48

    Backspace key

    Hello!
    I'm a noobie... and I am wondering how to make the backspace key on the keyboard work so that it leads to the previous frame as each "page" of the site is on a different frame on the main timeline.

    I've tried all sorts of things (eg. named anchors) but no luck so far. Do named anchors work in browsers on a Mac anyway?

    Is there an easy way to set this up with action script?

    I would greatly appreciate any help!

  2. #2
    Member
    Join Date
    Feb 2003
    Location
    California
    Posts
    90
    Key Object (Global)
    The Key object allows your movie to capture and react to the user's interaction with his or her keyboard—functionality that makes it possible for the user to perform certain tasks within the movie (such as navigating to different scenes), in response to spe-cific key presses or even combinations of key presses (similar to keyboard shortcuts).

    Scripts that involve the Key object are usually (though not always) executed as the result of onClipEvent(keyDown) or onClipEvent(keyUp) events. For example, if you want your project to navigate to the next frame in response to the spacebar being pressed, you would place the following script on a movie clip instance in the scene:

    onClipEvent(keyDown){
    if(Key.isDown(Key.SPACE)){
    _root.nextFrame();
    }
    }
    Notice that the isDown() method is looking for the spacebar being pressed by using the syntax Key.SPACE. You can use similar syntax—for example, Key.TAB, Key.SHIFT, Key.PGUP, and so on—to determine whether other "editing" keys, (Backspace, Tab, Shift, Page Up, Page Down, and so on) have been pressed. Although a limited number of keys are identified in this manner (located in the Object > Movie > Key > Constants book in the Toolbox List window), the Key object lets you get around this limitation by using ASCII key codes to identify specific keys.

    For example, the spacebar has an ASCII equivalent value of 32; thus, our previous script could be rewritten as follows:

    onClipEvent(keyDown){
    if(Key.isDown(32)){
    _root.nextFrame();
    }
    }
    Every key on the keyboard has an ASCII equivalent, which gives you far greater flexibil-ity in designating particular keys than the syntax approach shown in the first example.

    NOTE

    A complete list of ASCII key codes can be found in the Flash manual, which you can access from the authoring environment by pressing F1.

  3. #3
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397

  4. #4
    Member
    Join Date
    Nov 2003
    Location
    Southampton, UK
    Posts
    48
    Hello Guys,
    Thanks for the quick response and help. It's all sorted now and the client is happy again...!


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