[Flashcoders] preloader issue
I am really trying to have my preloader work, with a site that is 100% AS. the entire site resides either in classes or as on the first frame. there has got to be some way to preload a site, with a single function that is entirely dynamic. this is what i have, but it will not even appear on the screen. no errors .. ideas would be great // - // preloader function preloadMe() { // stop movie from playing //stop(); // reference to _root ref = _root; // create the preloader mc ref.createEmptyMovieClip("preloader_mc", ref.getNextHighestDepth() ); // create the preloader mc progress text ref.preloader_mc.createTextField("preloader_txt", ref.getNextHighestDepth, 0, 0, 200, 10); with (ref.preloader_mc.preloader_txt) { embedFonts = true; selectable = false; setNewTextFormat(format1_fmt); text = "LOADING SITE: 00" }; // place preloader text in center of stage ref.preloader_mc._x = (Stage.width/2) - (ref.preloader_mc.preloader_txt._width/2); ref.preloader_mc._y = (Stage.height/2) - (ref.preloader_mc.preloader_txt._height/2); ref.onEnterFrame = function() { tBytes = ref.getBytesTotal(); bLoaded = ref.getBytesLoaded(); percent = Math.round((bLoaded/tBytes)*100); // keep two places if percent is under 10, ie: 03 if (percent < 10) { percentTxt = "LOADING SITE: 0" + percent; } else { percentTxt = "LOADING SITE: " + percent; } // if this movie is not fully loaded, then display percent loaded if (bLoaded < tBytes) { ref.preloader_mc.preloader_txt.text = percentTxt; // otherwise, delete the preloader_mc, and the textField, then play movie } else { ref.preloader_mc.removeMovieClip(); ref.preloader_mc.preloader_txt.removeTextField(); play(); delete this.onEnterFrame; }; }; }; // - //makeContent(); //makeIt(); //alot(5); //trace(getDepth(_root.ellipse_0)); preloadMe(); ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [Flashcoders] preloader issue
> well, the preloader does display load status, then simply repeats, instead > of deleting itself, it just repeats the loading ... any ideas??? i just want > the swf it loads to not play or start until it is fully loaded, and the > label_txt is deleted etc ... It is probably also wise to never use onClipEvent or _root for that matter unless somebody has a gun to your head :) -K ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [Flashcoders] preloader issue
Not sure if anyone has responded yet -- my thread sorting is all screwed up. You cannot delete or terminate an onClipEvent(enterFrame) unless you delete the movieclp to which you have applied it, either by terminating it's existence on the timeline with an empty keyframe, or by swapping it to a "dynamic" depth (zero or above) and using removeMovieClip(). An onClipEvent(enterFrame) is not synonymous with an onEnterFrame() function. -- Byron "Barn" Canfield > well, the preloader does display load status, then simply repeats, instead > of deleting itself, it just repeats the loading ... any ideas??? i just > want > the swf it loads to not play or start until it is fully loaded, and the > label_txt is deleted etc ... > > > > onClipEvent(load) { >this.loadMovie("en.swf"); > } > > onClipEvent(enterFrame) { >tBytes = this.getBytesTotal(); >bLoaded = this.getBytesLoaded(); >percent = Math.round((bLoaded/tBytes)*100) >if (bLoaded _root.bar_mc._xscale = (bLoaded/tBytes)*100; > if (percent < 10) { > _root.label_txt.text = "0" + percent + "%"; > } > else { > _root.label_txt.text = percent + "%"; > } >} else { > _root.bar_mc.removeMovieClip(); > _root.label_txt.removeTextField(); > target_mc.play(); > delete _root.target_mc.onEnterFrame; >} > } > ___ > Flashcoders@chattyfig.figleaf.com > To change your subscription options or search the archive: > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > > Brought to you by Fig Leaf Software > Premier Authorized Adobe Consulting and Training > http://www.figleaf.com > http://training.figleaf.com > ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
[Flashcoders] preloader issue
well, the preloader does display load status, then simply repeats, instead of deleting itself, it just repeats the loading ... any ideas??? i just want the swf it loads to not play or start until it is fully loaded, and the label_txt is deleted etc ... onClipEvent(load) { this.loadMovie("en.swf"); } onClipEvent(enterFrame) { tBytes = this.getBytesTotal(); bLoaded = this.getBytesLoaded(); percent = Math.round((bLoaded/tBytes)*100) if (bLoadedhttp://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [Flashcoders] preloader issue?
This: percent = Math.round((bLoaded/tBytes)*100) works fine. murder design wrote: this code does work, however the percent displays something like 15 places ... onClipEvent (load) { this.loadMovie("bigfile.swf"); } onClipEvent (enterFrame) { tBytes = this.getBytesTotal(); trace("tBytes: "+tBytes); bLoaded = this.getBytesLoaded(); trace("bLoaded: "+bLoaded); percent = (bLoaded/tBytes)*100; if (bLoadedhttp://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com -- Thanks, ~ Bob Leisle Headsprout Software & Engineering http://www.headsprout.com Where kids learn to read! ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [Flashcoders] preloader issue?
did you try Math.round or math.round? this code does work, however the percent displays something like 15 places ... onClipEvent (load) { this.loadMovie("bigfile.swf"); } onClipEvent (enterFrame) { tBytes = this.getBytesTotal(); trace("tBytes: "+tBytes); bLoaded = this.getBytesLoaded(); trace("bLoaded: "+bLoaded); percent = (bLoaded/tBytes)*100; if (bLoadedhttp://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [Flashcoders] preloader issue?
this code does work, however the percent displays something like 15 places ... onClipEvent (load) { this.loadMovie("bigfile.swf"); } onClipEvent (enterFrame) { tBytes = this.getBytesTotal(); trace("tBytes: "+tBytes); bLoaded = this.getBytesLoaded(); trace("bLoaded: "+bLoaded); percent = (bLoaded/tBytes)*100; if (bLoadedhttp://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [Flashcoders] preloader issue?
Part of the problem is that your onEnterFrame is getting stomped on by the reinstantiation of the target movieclip when the SWF actually begins to load. That effectively (quite) deletes the onEnterFrame. Either attach the onEnterFrame to some other timeline, or load the movie into some other timeline, perhaps a child movieclip. -- Byron "Barn" Canfield > I have posted this before, and gotten some feedback, this is the result, > yet > i still cannot get the clip to display the load progress of "bigfile.swf" > inside the label_txt. the swf loads inside of _root.target_mc ... any > ideas > here people? > > // - begin code > target_mc.loadMovie("bigfile.swf"); > target_mc.onEnterFrame = function() { > tBytes = getBytesTotal(); > trace ("tBytes: " + tBytes); > bLoaded = getBytesLoaded(); > trace ("bLoaded: " + bLoaded); > percent = (bLoaded/tBytes) * 100; > if (bLoaded < tBytes){ >_root.bar_mc._xscale = (bLoaded/tBytes)*100; >_root.label_txt.text = percent & " % LOADED" > } else { >//play(); >//_root.target_mc.unloadMovie(); >delete this.onEnterFrame; > } > } > > // end code > > regards, edward > ___ > Flashcoders@chattyfig.figleaf.com > To change your subscription options or search the archive: > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > > Brought to you by Fig Leaf Software > Premier Authorized Adobe Consulting and Training > http://www.figleaf.com > http://training.figleaf.com > ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [Flashcoders] preloader issue?
one for all those with gmail On 3/7/06, Van Tuck <[EMAIL PROTECTED]> wrote: > If you attach this to the clip itself, it does work -> > > onClipEvent (load) { >this.loadMovie("bigfile.swf"); > } > onClipEvent (enterFrame) { >tBytes = this.getBytesTotal(); >trace("tBytes: "+tBytes); >bLoaded = this.getBytesLoaded(); >trace("bLoaded: "+bLoaded); >percent = (bLoaded/tBytes)*100; >if (bLoaded_root.bar_mc._xscale = (bLoaded/tBytes)*100; >_root.label_txt.text = percent & " % LOADED"; >} else { >//play(); >//_root.target_mc.unloadMovie(); >//delete this.onEnterFrame; >} > } > > > Van R Tuck > Director of Web Development > > Cause Design Group > 1519 Stanford Street Suite 6 > Santa Monica, CA 90404 > > t: 310.430.5369 > www.causedesigngroup.com > > > > > > On Mar 7, 2006, at 10:45 AM, murder design wrote: > > > I have posted this before, and gotten some feedback, this is the > > result, yet > > i still cannot get the clip to display the load progress of > > "bigfile.swf" > > inside the label_txt. the swf loads inside of _root.target_mc ... > > any ideas > > here people? > > > > // - begin code > > target_mc.loadMovie("bigfile.swf"); > > target_mc.onEnterFrame = function() { > > tBytes = getBytesTotal(); > > trace ("tBytes: " + tBytes); > > bLoaded = getBytesLoaded(); > > trace ("bLoaded: " + bLoaded); > > percent = (bLoaded/tBytes) * 100; > > if (bLoaded < tBytes){ > >_root.bar_mc._xscale = (bLoaded/tBytes)*100; > >_root.label_txt.text = percent & " % LOADED" > > } else { > >//play(); > >//_root.target_mc.unloadMovie(); > >delete this.onEnterFrame; > > } > > } > > > > // end code > > > > regards, edward > > ___ > > Flashcoders@chattyfig.figleaf.com > > To change your subscription options or search the archive: > > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > > > > Brought to you by Fig Leaf Software > > Premier Authorized Adobe Consulting and Training > > http://www.figleaf.com > > http://training.figleaf.com > > ___ > Flashcoders@chattyfig.figleaf.com > To change your subscription options or search the archive: > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > > Brought to you by Fig Leaf Software > Premier Authorized Adobe Consulting and Training > http://www.figleaf.com > http://training.figleaf.com > ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [Flashcoders] preloader issue?
If you attach this to the clip itself, it does work -> onClipEvent (load) { this.loadMovie("bigfile.swf"); } onClipEvent (enterFrame) { tBytes = this.getBytesTotal(); trace("tBytes: "+tBytes); bLoaded = this.getBytesLoaded(); trace("bLoaded: "+bLoaded); percent = (bLoaded/tBytes)*100; if (bLoadedI have posted this before, and gotten some feedback, this is the result, yet i still cannot get the clip to display the load progress of "bigfile.swf" inside the label_txt. the swf loads inside of _root.target_mc ... any ideas here people? // - begin code target_mc.loadMovie("bigfile.swf"); target_mc.onEnterFrame = function() { tBytes = getBytesTotal(); trace ("tBytes: " + tBytes); bLoaded = getBytesLoaded(); trace ("bLoaded: " + bLoaded); percent = (bLoaded/tBytes) * 100; if (bLoaded < tBytes){ _root.bar_mc._xscale = (bLoaded/tBytes)*100; _root.label_txt.text = percent & " % LOADED" } else { //play(); //_root.target_mc.unloadMovie(); delete this.onEnterFrame; } } // end code regards, edward ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
RE: [Flashcoders] preloader issue?
Also, double check the string concatenation. You had an ampersand in... >_root.label_txt.text = percent & " % LOADED" It should be a plus sign... >_root.label_txt.text = percent + " % LOADED" ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
RE: [Flashcoders] preloader issue?
are your trace statements showing the expected info? > -Original Message- > From: murder design [mailto:[EMAIL PROTECTED] > Sent: Tuesday, March 07, 2006 1:46 PM > To: Flashcoders mailing list > Subject: [Flashcoders] preloader issue? > > I have posted this before, and gotten some feedback, this is > the result, yet i still cannot get the clip to display the > load progress of "bigfile.swf" > inside the label_txt. the swf loads inside of _root.target_mc > ... any ideas here people? > > // - begin code > target_mc.loadMovie("bigfile.swf"); > target_mc.onEnterFrame = function() { > tBytes = getBytesTotal(); > trace ("tBytes: " + tBytes); > bLoaded = getBytesLoaded(); > trace ("bLoaded: " + bLoaded); > percent = (bLoaded/tBytes) * 100; > if (bLoaded < tBytes){ >_root.bar_mc._xscale = (bLoaded/tBytes)*100; >_root.label_txt.text = percent & " % LOADED" > } else { >//play(); >//_root.target_mc.unloadMovie(); >delete this.onEnterFrame; > } > } > > // end code > > regards, edward > ___ > Flashcoders@chattyfig.figleaf.com > To change your subscription options or search the archive: > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > > Brought to you by Fig Leaf Software > Premier Authorized Adobe Consulting and Training > http://www.figleaf.com http://training.figleaf.com > > > ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
[Flashcoders] preloader issue?
I have posted this before, and gotten some feedback, this is the result, yet i still cannot get the clip to display the load progress of "bigfile.swf" inside the label_txt. the swf loads inside of _root.target_mc ... any ideas here people? // - begin code target_mc.loadMovie("bigfile.swf"); target_mc.onEnterFrame = function() { tBytes = getBytesTotal(); trace ("tBytes: " + tBytes); bLoaded = getBytesLoaded(); trace ("bLoaded: " + bLoaded); percent = (bLoaded/tBytes) * 100; if (bLoaded < tBytes){ _root.bar_mc._xscale = (bLoaded/tBytes)*100; _root.label_txt.text = percent & " % LOADED" } else { //play(); //_root.target_mc.unloadMovie(); delete this.onEnterFrame; } } // end code regards, edward ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com