-
pause and unpause flv
Hi, everything works fine, the movie pauses fine but when I unpause it replays it from the beginning. How do I make it continue playing from where it was paused? Thanks!
Code:
import mx.utils.Delegate;
#include "mc_tween2.as"
var netConnection = new NetConnection();
netConnection.connect(null);
var netStream = new NetStream(netConnection);
netStream.setBufferTime(2);
VideoHolder.iVideo.attachVideo(netStream);
netStream.onStatus = function(infoObject:Object) {
var statusCode = infoObject.code;
var netStartPlay:String = "NetStream.Play.Start";
var netStopPlay:String = "NetStream.Play.Stop";
var netBufferFull:String = "NetStream.Buffer.Full";
switch (statusCode) {
case netStartPlay :
VideoHolder.alphaTo(100,.5,"easeInSine");
break;
case netStopPlay :
VideoHolder.alphaTo(0,.5,"easeOutSine")
break;
}
}
var isPlaying = false;
function playVideo(inURL:String) {
netStream.play(inURL);
isPlaying = true;
}
controls.playBtn.onRelease=function() {
if( isPlaying == false ) {
playVideo("testmovie.flv");
controls.playBtn.gotoAndPlay(2);
}
else {
controls.playBtn.gotoAndPlay(1);
isPlaying = false;
netStream.pause();
}
}
-
play() starts the NetStream from the beginning. pause() stops or restarts play from where it was. You can also pass true or false i.e. pause(false).
-
not really
actually as far as i can tell that advice is no good. pause() does nothing whatsoever to movieclips in my project. perhaps it doesn't work in 2.0?
if (Key.isDown(Key.SPACE)) {
if (pausing == false) {
pausing = true;
themesound.stop();
Character_mc.pause(true);
hitting the spacebar does nothing but stop the music in this example.
-
You stop movieclips with stop(), i.e. myMovieClip.stop();. You pause Netstream objects (video) with pause().
-
yeah got it working finally! stop() and play() just had to make sure to put it on every single movie clip (needed a pause button in the game im making). definitely PITA but at least it works
-
I'm trying to pause/unpause an flv from the main timeline. Did this work, and can you please explain how to use the code? Like, if it goes on a button or keyframe. I'm not very good at this part...
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
|