-
isPlaying
Hi guys,
In flash as3 how can we use "isPlaying". Pls give me some example.
-
that is useful when making a sound toggle button (on/off)
PHP Code:
var isPlaying:Boolean = false;
soundOnOff_btn.addEventListener(MouseEvent.CLICK, toggleSound);
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; } }
-
isPlaying is not a function?
-
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++;
}
-
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|