
Welcome Guest
|
#1
|
|||
|
|||
|
Load moving without auto play
I have searched for about 2 days now and I still can't figure this out. I have a movie player that uses XML to load the movies. The movie will automatically start playing when you open the page. What I want the player to do is load up with the movie paused at the 1st frame (you can see the image) so to speak. I then want a play button in the middle of the movie that will obviously disappear when you click it. Similiar to youtube. Anyone have any ideas? I tried treating it like a buffer clip but I still can't get it to work.
I am using actionscript 2.0 in CS3 here is my code so far (without the xml code): Actionscript:
var nc:NetConnection = new NetConnection();
nc.connect(null);
var ns:NetStream = new NetStream(nc);
ns.setBufferTime(30);
ns.onStatus = function(info) {
if(info.code == "NetStream.Buffer.Full") {
bufferClip._visible = false;
}
if(info.code == "NetStream.Buffer.Empty") {
bufferClip._visible = true;
}
if(info.code == "NetStream.Buffer.Stop") {
ns.seek(0);
}
}
theVideo.attachVideo(ns);
ns.play("test.flv");
rewindButton.onRelease = function() {
ns.seek(0);
}
playButton.onRelease = function() {
ns.pause();
}
var videoInterval = setInterval(videoStatus,100);
var amountLoaded:Number;
var duration:Number;
ns["onMetaData"] = function(obj) {
duration = obj.duration;
}
function videoStatus() {
amountLoaded = ns.bytesLoaded / ns.bytesTotal;
loader.loadbar._width = amountLoaded * 134;
loader.scrub._x = ns.time / duration * 134;
}
var scrubInterval;
loader.scrub.onPress = function() {
clearInterval(videoInterval);
scrubInterval = setInterval(scrubit,10);
this.startDrag(scrub,false,this._y,133.9,this._y,-0.1);
}
loader.scrub.onRelease = loader.scrub.onReleaseOutside = function() {
clearInterval(scrubInterval);
videoInterval = setInterval(videoStatus,100);
this.stopDrag();
}
function scrubit() {
ns.seek(Math.floor((loader.scrub._x/133.9)*duration));
}
_root.createEmptyMovieClip("vSound",_root.getNextHighestDepth());
vSound.attachAudio(ns);
var so:Sound = new Sound(vSound);
so.setVolume(100);
mute.onRollOver = function() {
if(so.getVolume() == 100) {
this.gotoAndStop("onOver");
}
else {
this.gotoAndStop("muteOver");
}
}
mute.onRollOut = function() {
if(so.getVolume() == 100) {
this.gotoAndStop("on");
}
else {
this.gotoAndStop("mute");
}
}
mute.onRelease = function() {
if(so.getVolume() == 100) {
so.setVolume(0);
this.gotoAndStop("muteOver");
}
else {
so.setVolume(100);
this.gotoAndStop("onOver");
}
} |
|
#2
|
||||
|
||||
Actionscript:
if(info.code == "NetStream.Buffer.Full") {
bufferClip._visible = false;
ns.pause()
}
__________________
.:To me AS is like LEGO, Only for the big Kids :. - Site - Blog - Glasgow Flasher - Activeden - bringmadeleinehome.com |
|
#3
|
|||
|
|||
|
Quote:
wow, i kind of feel like an idiot now. Thank you! <3 |
«
Previous Thread
|
Next Thread
»
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| load an image from xml file into main.swf movie before play an effect on it? | sundeep_02tv26 | Flash MX ActionScript |
3 | 04-03-2007 11:41 AM |
| movie clip stop auto play | tiaka | Newbies |
3 | 07-08-2006 12:23 AM |
| Detecting Movie Parameters \ Sound Play Button Problem | MathieuGPL | Flash MX ActionScript |
2 | 07-26-2005 06:09 PM |
| rotate ads - play next ad on each page load | gomango | Flash MX ActionScript |
1 | 07-21-2005 04:51 AM |
| Load movie and play it once ??? help | stevet26 | General Flash | 1 | 02-07-2003 10:37 AM |




