A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: isPlaying

  1. #1
    Member
    Join Date
    Feb 2010
    Posts
    79

    isPlaying

    Hi guys,

    In flash as3 how can we use "isPlaying". Pls give me some example.

  2. #2
    Senior Member
    Join Date
    Jan 2010
    Posts
    141
    that is useful when making a sound toggle button (on/off)

    PHP Code:
    var isPlaying:Boolean false;

    soundOnOff_btn.addEventListener(MouseEvent.CLICKtoggleSound);

    function 
    toggleSound (event:MouseEvent):void{
        if (
    isPlaying == false) {  //checks to see if sound is playing
            
    sound.play;
            
    isPlaying true///now that sound is playing must change boolean
        
    } else {
            
    sound.stop;
    isPlaying false;
        }


  3. #3
    Member
    Join Date
    Feb 2010
    Posts
    79
    isPlaying is not a function?

  4. #4
    Senior Member
    Join Date
    Jan 2010
    Posts
    141
    I've only used it as a variable.... here is what I found about it being a function...


    Name: isPlaying() - sees if movieclip is playing
    Author: senocular: www.senocular.com
    Date: 1899-12-31T00:29:45.700
    Documentation:
    Movieclip ISPLAYING: determines if the playhead of
    the current movieclip is moving or not. If yes, true is
    returned, if not, false.

    Returns:
    - returns true if the movieclip is playing, which is defined by the frame of the moveiclip
    now being different from the frame of the movieclip in the previous frame. False is returned
    if the movieclip is not playing or the frame of that clips timeline is the same as the
    previous frame of the movie

    Warning:
    - This is meant to be continuously called within an enterFrame event. The reason is because
    isPlaying creates the _previousframe property it uses to check to see if the playhead has in
    fact moved. If this isnt used in this manner, isPlaying will base its determination of whether
    or not the playhead is moving based on the last time it was called which was the last time it
    created the _previousframe property for that given object.

    Example:
    // moveiclip which only moves down while the main timeline is playing
    onClipEvent(enterFrame){
    if (_root.isPlaying()) _y++;
    }

  5. #5
    Member
    Join Date
    Feb 2010
    Posts
    79
    ok... thanks.

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