A Flash Developer Resource Site

Results 1 to 16 of 16

Thread: get next frame?

  1. #1
    Member
    Join Date
    Feb 2007
    Posts
    36

    get next frame?

    is there anyway in AS that you can automatically get the next frame when called? Much like _root.getNextHighestDepth works, is there any way to do this? I want it so that on each press the frame is stopped and then when it is pressed again it advances to the next frame.

  2. #2
    5+5=55 Schfifty Five's Avatar
    Join Date
    Jun 2006
    Posts
    698
    You mean like... _root._currentframe+1?

  3. #3
    Member
    Join Date
    Feb 2007
    Posts
    36
    well I have something on the frame and i want it to play that something like

    this is inside a onKeydown fuction:
    _root.MC.nextFrame();

    but when i do this the key down press only advances the frame once, and I want it to advance the frame each time the key is pressed

  4. #4
    5+5=55 Schfifty Five's Avatar
    Join Date
    Jun 2006
    Posts
    698
    Can you post the entire code?

  5. #5
    Member
    Join Date
    Feb 2007
    Posts
    36
    code:

    if((clipArray[i]._y + clipArray[i]._height) >= (btn[0]._y + 17) && clipArray[i]._y <= (btn[0]._y + btn[0]._height - 20)){
    if(Key.isDown(49)){
    if(movX[i] > btn[0]._x && movX[i] < (btn[0]._x + btn[0]._width)){
    clipArray[i]._alpha = 0;
    //sound up
    fade=90;
    _root.Status.nextFrame();
    }






    This controls one of the button presses and the particular part that i want is the _root.Status.nextFrame.

    The whole code is 180 lines long. so posting the whole thing would not be efficient.

  6. #6
    Member
    Join Date
    Feb 2007
    Posts
    36
    i need it to advance to the next frame every time key 40 (button 1) is pressed.

  7. #7
    5+5=55 Schfifty Five's Avatar
    Join Date
    Jun 2006
    Posts
    698
    How about something like:
    Code:
    keyPressed = false;
    this.onEnterFrame = function() {
    	if (Key.isDown(49) && !keyPressed) {
    		keyPressed = true;
    		_root.nextFrame();
    	} else if(!Key.isDown(49)){
    		keyPressed = false;
    	}
    };

  8. #8
    Member
    Join Date
    Feb 2007
    Posts
    36
    thanks i'll try it

  9. #9
    Member
    Join Date
    Feb 2007
    Posts
    36
    see the problem is that I have attached the MC through AS so it's not just placed on the screen, so I can't put code on it, I have to do it like this

    _root.MC.nextFrame();

    and when I do this it advances once, but dosn't work any more than once.

  10. #10
    5+5=55 Schfifty Five's Avatar
    Join Date
    Jun 2006
    Posts
    698
    Would _root.MC.gotoAndStop(_root.MC._currentframe+1) work?

  11. #11
    Member
    Join Date
    Feb 2007
    Posts
    36
    nope didn't work. sorry it took so long to get back i just go through spurts on working on this thing.

    any other suggestions?

  12. #12
    flip-flopper scottPadgett's Avatar
    Join Date
    Jan 2005
    Location
    Boston
    Posts
    425

    how about

    _root.MC.gotoAndStop(_root._currentframe + 1);

    you're trying to move everything along to next frame on the main timeline right?
    :: scott ::

  13. #13
    Member
    Join Date
    Feb 2007
    Posts
    36
    nope I just need one movieclip to advance to the next frame every time a button is pushed. it works once but then stops working.

  14. #14
    flip-flopper scottPadgett's Avatar
    Join Date
    Jan 2005
    Location
    Boston
    Posts
    425
    your conditional is still met after the first execution? is it possible the conditional no longer evaluates true, and thus just doesn't run again?
    :: scott ::

  15. #15
    Member
    Join Date
    Feb 2007
    Posts
    36
    AHH! i just figured it out, whats happening is it's going true and staying true, therefore it can't go to the next because it never gets to false again, is this a possibility?

  16. #16
    flip-flopper scottPadgett's Avatar
    Join Date
    Jan 2005
    Location
    Boston
    Posts
    425
    cool. i thought it might be that...
    :: scott ::

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