A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: AS2 Failing?

  1. #1
    Registered User
    Join Date
    Jul 2010
    Posts
    1

    Unhappy AS2 Failing?

    Ok. Here's my situation: I have Macromedia Flash 8 Professional, full version, and I'm making a simple game. I've put alot of effort in so far, and really don't want to give up. In one of my cutscenes, there are speech bubbles, and I want the viewer to be able to press SPACE to move on instead of me guessing their reading speed and the bubble finishing too early or late. At 25fps, I couldn't just bung the code onto the frame or they would have the first 0.04 of a second to hit SPACE. So, for one bubble I made two frames, and coded the second as follows:

    gotoAndPlay(<firstframe>);

    <firstframe> being the number of the first frame. This meant I had a recurring scene that looked still. On both frames I instanced a small blank movie clip, to which I scripted:

    onClipEvent(enterFrame) {
    if ((Key.isDown(Key.SPACE))) {
    gotoAndPlay(<nextframe>);
    }
    }

    <nextframe> being the next recurring scene. I thought this would solve the problem (having the movie clip constantly refreshing the SPACE check), but It does not work at all. Any ideas?

  2. #2
    var x:Number = 1; x /= 0;
    Join Date
    Dec 2004
    Posts
    549
    just put this code on the frame:
    Code:
    stop();
    var keylistener:Object=new Object();
    keylistener.onKeyDown(){
        if(Key.getCode==Key.SPACE)
            gotoAndPlay(<nextframe>);
        Key.removeListener(this);
    }
    Key.addListener(keylistener);
    That should do it.
    Z¡µµ¥ D££

    Soup In A Box

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