A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: [Help] (AS 2) Going to the next frame and back by pushing spacebar

  1. #1
    Junior Member
    Join Date
    Feb 2010
    Posts
    19

    [Help] (AS 2) Going to the next frame and back by pushing spacebar

    I want to, when I push the spacebar, go to the next frame, but only when I push the spacebar. And if that frame is up, I want to go to the previous frame by pushing spacebar again. Im sorry if this isnt very specific. If you need more info on what im doing then I can give it.

  2. #2
    Senior Member tonypa's Avatar
    Join Date
    Jul 2001
    Location
    Estonia
    Posts
    8,223
    Code:
    box.onEnterFrame = function() {
    	if (Key.isDown(Key.SPACE)) {
    		if(this.spacekey == false){
    			this.spacekey = true;
    			if(this._currentframe == 1){
    				this.gotoAndStop(2);
    			}else{
    				this.gotoAndStop(1);
    			}
    		}
    	}else{
    		this.spacekey = false;
    	}
    };

  3. #3
    Junior Member
    Join Date
    Feb 2010
    Posts
    19
    Should that be put in the action section of my fames? or should it be put in my main coding area? When I put it in my frames, then it still switches back and forth between frames. But when I put it in my box, it says that tehre is no property with the name box. When I put a var in called box, it still keeps going back and forth between screens.

  4. #4
    Senior Member tonypa's Avatar
    Join Date
    Jul 2001
    Location
    Estonia
    Posts
    8,223
    The box would be instance name of movie clip that you want to send between frames 1 and 2.

  5. #5
    Junior Member
    Join Date
    Feb 2010
    Posts
    19
    so that could really be anything then right? it doesnt have to be box, it could say Pause Screen?

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