A Flash Developer Resource Site

Results 1 to 7 of 7

Thread: Play until frame# then stop?

  1. #1
    I'm not afraid Fearless's Avatar
    Join Date
    Jun 2000
    Posts
    351

    Play until frame# then stop?

    I'm working on a sort of flash "magazine" and I'm using two types of navigation. First is just a next button the flip the page which is simple. The second is a little more complicated.

    I want to be able to flip forward to any page from the "table of contents", but I don't want to skip directly to it. I want each page to turn until I get to that point. (ie: from page 1 each corresponding page should flip through to get to page 11)I can't use the usual stop action because that would break at every page. So I was wondering if there is some actionscript to accomplish this.

    Thanks,
    Fearless

  2. #2
    Member
    Join Date
    Feb 2001
    Location
    Melbourne, Australia
    Posts
    67
    I would make the buttons define the desired page to be at:

    on (release) {
    desiredPage = 2; // or whatever
    }

    Then, have ano empty MC with the following code:

    onClipEvent (enterFrame) {
    if(_parent._currentframe < _parent.desiredPage){
    _parent.gotoAndPlay(_parent._currentframe++);
    }else{
    _parent.stop();
    }
    }

    This may make it awkward if you need to go backwards, and I guess you don't want to play your movie backwards, so add:

    onClipEvent (enterFrame) {
    if(_parent._currentframe < _parent.desiredPage){
    _parent.gotoAndPlay(_parent._currentframe++);
    }else if(_parent._currentframe > _parent.desiredPage){
    _parent.gotoAndStop(_parent.desiredPage);
    }else{
    _parent.stop();
    }
    }

    Of course, you could play it backwards if you wanted (_currentframe--)
    [ + introspection - ]
    FlashKit Featured Site

  3. #3
    I'm not afraid Fearless's Avatar
    Join Date
    Jun 2000
    Posts
    351
    That worked awesome, but I actually do want to be able to run it backwards as well, I tried the currentframe-- but that just jumped to that frame instead of actually playing the movie backwards. Any Ideas?

    Thanks Again,
    Fearless

  4. #4
    Senior Member
    Join Date
    Aug 2001
    Posts
    128
    I dont think it is actually possible to play the movie backwards.

    The best you can do is 'Reverse' the frames. You will find this option by selecting your frames, right clicking then selecting 'reverse frames'
    [swf width="300" height="40" background="#000000"]http://www.zizunetwork.com/zizunetworkcouk.swf[/swf]

  5. #5
    Member
    Join Date
    Feb 2001
    Location
    Melbourne, Australia
    Posts
    67
    Oh yeah, didn't work for me either.....but this does:

    onClipEvent (enterFrame) {
    _parent.xx = _parent._currentframe;
    if (_parent._currentframe<_parent.desiredPage) {
    _parent.gotoAndPlay(_parent._currentframe++);
    } else if (_parent._currentframe>_parent.desiredPage) {
    _parent.gotoAndStop(_parent._currentframe-1);
    } else {
    _parent.stop();
    }
    }
    [ + introspection - ]
    FlashKit Featured Site

  6. #6
    Member
    Join Date
    Feb 2001
    Location
    Melbourne, Australia
    Posts
    67
    oh ignore the line:
    _parent.xx = _parent._currentframe;

    that was for my own testing purposes.

    Here's all you need:

    onClipEvent (enterFrame) {
    if (_parent._currentframe<_parent.desiredPage) {
    _parent.gotoAndPlay(_parent._currentframe++);
    } else if (_parent._currentframe>_parent.desiredPage) {
    _parent.gotoAndStop(_parent._currentframe-1);
    } else {
    _parent.stop();
    }
    }
    [ + introspection - ]
    FlashKit Featured Site

  7. #7
    I'm not afraid Fearless's Avatar
    Join Date
    Jun 2000
    Posts
    351
    That worked great intro! Thanks a million.

    -Fearless

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