jlackyashdya
01-14-2008, 04:42 AM
hi,
i have added preloader to my gallery using "progress bar" component of flash.
its working fine with images. but now i want to add it to flv's. And i m not getting how to connect progress bar to flv.
my code is as followes : this code is for adding a progressbar component (instance name = my_pb) to images. And this code is working fine.
var movieClipLoader:MovieClipLoader = new MovieClipLoader();
var loaderListener:Object = new Object();
// preloader code starts
loaderListener.onLoadProgress = function(target:MovieClip, numBytesLoaded:Number, numBytesTotal:Number):Void {
_root.emptymc_mc.my_pb._visible = true;
var numPercentLoaded:Number = numBytesLoaded / numBytesTotal * 100;
_root.emptymc_mc.my_pb.setProgress(numBytesLoaded, numBytesTotal);
trace("onLoadProgress: " + target + " is " + numPercentLoaded + "% loaded");
};
// preloader code ends
//Use the onLoadInit function to get the loaded images proportions
loaderListener.onLoadInit = function(target:MovieClip) {
_root.emptymc_mc.my_pb._visible = false;
// now loading images into movie clip loader
movieClipLoader.addListener(loaderListener);
var movieClipHolder:MovieClip = _root.emptymc_mc.imagemc_mc.createEmptyMovieClip("container", getNextHighestDepth());
var movieClipLoaderTarget:MovieClip = movieClipHolder.createEmptyMovieClip("loader", 1);
//Load an image to the target
movieClipLoader.loadClip(thumbs.firstChild.childNo des[0].childNodes[j].childNodes[0].nodeValue, movieClipLoaderTarget);
now this is my flv code: now how can i connect progressbar component (instance name = my_pb) to this code. because here , i m not using loader component to load flv's.
for(i=0; i<=flvlength; i++)
{
_root.emptymc_mc.scrollmc_mc["flv"+i].onRelease = function()
{
for(k=0; k<=flvlength; k++)
{
if(this._name == "flv"+k)
{
_root.emptymc_mc.imagemc_mc.container.removeMovieC lip();
_root.emptymc_mc.mainmc_mc.attachMovie("flv_player","flv_player",1);
_root.emptymc_mc.mainmc_mc['flv_player']._x = -40 +_root.emptymc_mc.mainmc_mc._width/2 - _root.emptymc_mc.mainmc_mc['flv_player']._width/2;
_root.emptymc_mc.mainmc_mc['flv_player']._y = -55 +_root.emptymc_mc.mainmc_mc._height/2 - _root.emptymc_mc.mainmc_mc['flv_player']._height/2;
_root.emptymc_mc.mainmc_mc['flv_player'].varPath = thumbs.firstChild.childNodes[3].childNodes[k].childNodes[0].nodeValue;
}// end if
}//end for
}//end click event
}//end main for
can someone help me???
please reply....:rolleyes:
jlackyashdya
i have added preloader to my gallery using "progress bar" component of flash.
its working fine with images. but now i want to add it to flv's. And i m not getting how to connect progress bar to flv.
my code is as followes : this code is for adding a progressbar component (instance name = my_pb) to images. And this code is working fine.
var movieClipLoader:MovieClipLoader = new MovieClipLoader();
var loaderListener:Object = new Object();
// preloader code starts
loaderListener.onLoadProgress = function(target:MovieClip, numBytesLoaded:Number, numBytesTotal:Number):Void {
_root.emptymc_mc.my_pb._visible = true;
var numPercentLoaded:Number = numBytesLoaded / numBytesTotal * 100;
_root.emptymc_mc.my_pb.setProgress(numBytesLoaded, numBytesTotal);
trace("onLoadProgress: " + target + " is " + numPercentLoaded + "% loaded");
};
// preloader code ends
//Use the onLoadInit function to get the loaded images proportions
loaderListener.onLoadInit = function(target:MovieClip) {
_root.emptymc_mc.my_pb._visible = false;
// now loading images into movie clip loader
movieClipLoader.addListener(loaderListener);
var movieClipHolder:MovieClip = _root.emptymc_mc.imagemc_mc.createEmptyMovieClip("container", getNextHighestDepth());
var movieClipLoaderTarget:MovieClip = movieClipHolder.createEmptyMovieClip("loader", 1);
//Load an image to the target
movieClipLoader.loadClip(thumbs.firstChild.childNo des[0].childNodes[j].childNodes[0].nodeValue, movieClipLoaderTarget);
now this is my flv code: now how can i connect progressbar component (instance name = my_pb) to this code. because here , i m not using loader component to load flv's.
for(i=0; i<=flvlength; i++)
{
_root.emptymc_mc.scrollmc_mc["flv"+i].onRelease = function()
{
for(k=0; k<=flvlength; k++)
{
if(this._name == "flv"+k)
{
_root.emptymc_mc.imagemc_mc.container.removeMovieC lip();
_root.emptymc_mc.mainmc_mc.attachMovie("flv_player","flv_player",1);
_root.emptymc_mc.mainmc_mc['flv_player']._x = -40 +_root.emptymc_mc.mainmc_mc._width/2 - _root.emptymc_mc.mainmc_mc['flv_player']._width/2;
_root.emptymc_mc.mainmc_mc['flv_player']._y = -55 +_root.emptymc_mc.mainmc_mc._height/2 - _root.emptymc_mc.mainmc_mc['flv_player']._height/2;
_root.emptymc_mc.mainmc_mc['flv_player'].varPath = thumbs.firstChild.childNodes[3].childNodes[k].childNodes[0].nodeValue;
}// end if
}//end for
}//end click event
}//end main for
can someone help me???
please reply....:rolleyes:
jlackyashdya