FORUMS: list search recent posts

problems with loader

COW Forums : Adobe Flash

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
marcoshoracio
problems with loader
on Mar 11, 2006 at 12:31:53 am

Hi there,

I've been trying to add a loadbar and a scrubber to different video clips on my flash movie but I haven't succeeded yet. I followed Lee Brimelow's tutorials with no luck. My action script looks exactly the same as Lee's. The video loads fine and so do the playback controls but the loadbar doesn't. I was wondering if there's any restriction to using a scrubber if I'm using multiple video clips(they're all arranged accross may main scene's timeline) and each one has its own set of code.

Here is the code. I'd appreciate if someone could help me decyphering this one. Thanks!

my_nc = new NetConnection();
my_nc.connect(null);
my_ns = new NetStream(my_nc);
my_videosnow.attachVideo(my_ns);
play.onPress = function(){
my_ns.play("http://www.marcosh.com/Snowboarding.flv");
}
pause.onPress = function(){
my_ns.pause([pauseResume]);
}
rewind.onPress = function(){
my_ns.seek(0);
}

this.createEmptyMovieClip("vFrame",this.getNextHighestDepth());
vFrame.onEnterFrame = videoStatus;
var amountLoaded:Number;
var duration:Number;

ns["onMetaData"] = function(obj) {
duration = obj.duration;
}

function videoStatus() {
amountLoaded = ns.bytesLoaded / ns.bytesTotal;
loader.loadBar._width = amountLoaded * 250;
loader.scrub._x = ns.time / duration * 250;
loader.progressBar._width = loader.scrub._x;
}

loader.scrub.onPress = function() {
vFrame.onEnterFrame = scrubit;
this.startDrag(false,0,this._y,240,this._y);
}

loader.scrub.onRelease = loader.scrub.onReleaseOutside = function() {
vFrame.onEnterFrame = videoStatus;
this.stopDrag();
}

function scrubit() {
ns.seek(Math.floor((loader.scrub._x/240)*duration));
loader.progressBar._width = loader.scrub._x;
}




Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2018 CreativeCOW.net All Rights Reserved
[TOP]