flash actionscript:
Good evening, I'm having some issues with flash as I try to integrate my slide presentation into my master loader. Basically I use the movieclip loader class to load all movies (the background, the interface and the content). All content are made from slides. while in the onLoadInit method for the moviecliploader I tell it I want to find the numChildSlides. It behaves like it isn't there, but of course it loads onto the page after everything else is loaded. If I use the interface to change between slides it works like a champ. if the code is in the slide directly I can do this._childslides and get the full path names which show: "_level0.presentation" if done through the loader I get "undefined" Is there some additional switch I should try or do? I feel that the slides load differently from my findings. It's almost as it takes longer or there's something missing from the movieclip loader that tells it's complete. What has you all's experiences been with this? Did you all find a solution? Thanks for all the help, Kelly
mmmk, So here's what I have so far for code: Of course, I haven't found a solution yet. :( Anyone out there know of something to try? //layer 1 frame 1 //Fscommands fscommand("showmenu", false); fscommand("fullscreen ", false); var MaxWidth4ProgressBar:Number = 550; var nameSplice:String = "_level"; var hasMC:Boolean = false; var currentPercent:Number = 0; var pathName:String = ""; var filesCounter:Number = 0; var nMaxFiles:Number = 0; var the_mcl:MovieClipLoader = new MovieClipLoader(); var the_listener: Object = new Object(); // I broke up this line because of the emoticons that show on here the_listener.onLoadError = function(mc:MovieClip) { trace("Error"); }; the_listener.onLoadProgress = function(mc:MovieClip, bytesLoaded:Number, bytesTotal:Number) { currentPercent = Math.round(bytesLoaded/bytesTotal*100); LoadBar_mc._width = (currentPercent*MaxWidth4ProgressBar)/100; tLoader = tLoader +"/n loading... " + mc._name + " " + bytesLoaded + "kb of "+ bytesTotal + "kb"; }; the_listener.onLoadComplete = function(mc:MovieClip){ tLoader ="Loading Complete"; }; the_listener.onLoadInit = function(mc:MovieClip) { DuringTheLoad(mc); }; function DuringTheLoad(mc:MovieClip){ for (var item in mc){ if (typeof (mc[item]) == "movieclip") { hasMC = true; //trace("\t I have a movie clip child named "+item); }else if ([item] instanceof mx.screens.Screen) { //this doesn't work! trace("\t \t I have a Slide child named "+item); trace("\t \t _ChildSlides "+ [item].presentation._ChildSlides); } trace(mc+"["+item+"] "+ mc[item]+" == "+typeof(mc[item])); } trace ("hasMC "+hasMC); if(!hasMC){ trace ("if hasMC "+hasMC); trace ("setProperty("+mc+",_visible,0)"); setProperty(mc,_visible,0); setProperty(mc,_alpha,0); } //} //trace ("filesCounter: "+filesCounter+"==nMaxFiles: "+nMaxFiles); if (filesCounter==nMaxFiles){ _level1.gotoAndPlay(2); //_level20.presentation._visible = true; } //this.nextFrame(); trace("\n \n"); for (var I:Number = 0; I<nContentCounter; I++){ container = I+20; TheContent_ary[I,2] = eval("_level"+container+".presentation.numChildSlides"); trace("tracing the level "+TheContent_ary[I,2]); } } the_mcl.addListener(the_listener); //layer 2 frame 1 //------------------------------------------------------------------------------ -- var TheContent_ary:Array = new Array(); var nContentCounter:Number = 0; //we need to establish the start number for the content movieclips var nLevelStartNumber:Number = 20; //---------------------------------XML------------------------------------------ -- //Load the XML file which tells loader what files are loading var LoadingTheseFiles_xml:XML = new XML(); //set XML perams LoadingTheseFiles_xml.ignoreWhite = true; //NOTE: set all XML paramaters before you "load" the file LoadingTheseFiles_xml.load("courseplan/load.xml"); //while loading the XML file load to class LoadingTheseFiles_xml.onLoad = function (){ nMaxFiles = this.firstChild.childNodes.length; //if the XML file is loaded (true) if(this.loaded){ for (var aNode:XMLNode = LoadingTheseFiles_xml.firstChild.firstChild; aNode != null; aNode=aNode.nextSibling) { tLoader = "Loading... " + aNode.attributes.name; if(aNode.attributes.id =="interface"){ //trace(pathName + aNode.attributes.name+".swf"); the_mcl.loadClip(pathName + aNode.attributes.name + ".swf", Number(aNode.attributes.level)); }else{ //trace(pathName + "courseplan/" + aNode.attributes.name+".swf"); the_mcl.loadClip(pathName + "courseplan/" + aNode.attributes.name + ".swf", Number(aNode.attributes.level)); TheContent_ary[nContentCounter,0] = aNode.attributes.name; TheContent_ary[nContentCounter,1] = Number(aNode.attributes.level) //trace("_level"+Number(aNode.attributes.level) +" "+evsl("_level"+Number(aNode.attributes.level)+"Presentation._visible")); nContentCounter++; } trace("nContentCounter "+ nContentCounter); filesCounter++; } }else{ //trace("Load unsuccessful..."); } //trace("TheContent_ary["+0+","+0+"] "+TheContent_ary[0,0] +" TheContent_ary["+0+","+1+"] "+TheContent_ary[0,1]); }; //----------------------------EXD XML---------------------------------------------- //layer 3 frame 1 stop();
Ok, I've wound up playing with the code some and this is the current solution //layer1 frame 1 function DuringTheLoad(mc:MovieClip){ for (var item in mc){ if (typeof (mc[item]) == "movieclip") { hasMC = true; }else if ([item] instanceof mx.screens.Screen) { //this doesn't work! } } if(!hasMC){ setProperty(mc,_visible,0); setProperty(mc,_alpha,0); } if (filesCounter==nMaxFiles){ _level1.gotoAndPlay(2); } //this.nextFrame(); }
Don't see what you're looking for? Try a search.
|