Click to start from frame 1 and play till frame 36.
Click again at anytime to start from frame 36 and play to the end.

----------------------------------------------------------

init ( btn );

function init ( $:MovieClip )
{
      var _ = this;
      $.frameOff = 1;
      $.frameOn = 36;
      $.onPress = function()
      {
            this.swapDepths ( 1000 );
            if ( this.isOpen ) _.close ( this ); else _.open ( this );
      }
}

function open ( $:MovieClip )
{
      $.isOpen = true;
      destinationFrame ( $, 1, $.frameOn );
}

function close ( $:MovieClip )
{
      $.isOpen = false;
      destinationFrame ( $, $.frameOn, $._totalframes );
}

function destinationFrame ( $:MovieClip, startFrame:Number, endFrame:Number
)
{
      startFrame = Math.max( 1, Math.min ( $._totalframes, startFrame ) );
      endFrame = Math.max( 1, Math.min ( $._totalframes, endFrame ) );

      $.gotoAndStop ( startFrame );
      $.onEnterFrame = function()
      {
            if (( endFrame - $._currentframe) < 0 ) $.prevFrame(); else
$.nextFrame();
            if ( $._currentframe == endFrame )
            {
                  delete $.onEnterFrame;
            }
      }
}

_____________________________

Jesse Graupmann
www.jessegraupmann.com 
www.justgooddesign.com/blog/ 
_____________________________



-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Paul V.
Sent: Friday, June 29, 2007 12:49 PM
To: Flash Coders
Subject: [Flashcoders] gotoAndPlay Problem (replaying a nested clip)

pressNum=0;  // toggle variable

page.p9.onPress = function(){    
this.swapDepths(10000);  

 if(pressNum !=1){openPlay(this);}
 else{closePlay(this);} 
}

function openPlay(p){
 pressNum =1;   
 p.gotoAndStop(1);   
 p.gotoAndPlay("start");  //start is 2nd frame
}

function closePlay(p){       
p.gotoAndPlay(36);   //36 center frame
pressNum =0;
}

Vdst.

_______________________________________________
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to