Preloader works with SWF but not in browser...?

the thread title says it all… if i type the direct URL of my SWF my preloader works like it should. i’ve also embedded the same SWF inside an HTML document and when i view the HTML doc the SWF goes to 100% and stops. it’s not even a very big movie (100 KB). what gives?

Can you post the fla?

i used the percentage preloader found on kirupa.com with some modifications…

in frame 2 i have:

////
if (bytes_loaded == bytes_total) {
this.gotoAndPlay(3);
}

if (bytes_loaded != bytes_total) {
this.gotoAndPlay(1);
}
////

because if i put the script with the == in the first frame i get something weird and it locks up the browser. a screenshot of that is attached.

does the same thing in Mozilla Firebird, Mozilla 1.3, IE 5.5, and IE 6.

the attached image makes me think that there’s something awful looping over and over, but then it works when it’s not in an HTML document. it’s the same document i published right from Flash too.

On first frame:[AS]bytes_loaded = Math.round(this.getBytesLoaded());
bytes_total = Math.round(this.getBytesTotal());
getPercent = bytes_loaded/bytes_total;
this.loadBar._width = getPercent100;
this.loadText = Math.round(getPercent
100)+"%";
if (bytes_loaded == bytes_total) {
this.gotoAndPlay(3);
}[/AS]And on 2nd frame:[AS]this.gotoAndStop(3);[/AS]

thanks claudio. that’s just the code from the tutorial right? i actually just scrapped the file i had and started a new one and it works. so how does this one work, since there’s no action to send it back to the first frame if the movie isn’t loaded yet? not doubting you, just curious.

UPDATE: this code didn’t actually work for me, it just jumped to the 3rd frame like i thought it would and didn’t load the 500 KB image i threw onto Frame 3 just to make it a bigger download (broadband = too fast to test a small preloader).

anyway, i will just start it over, should work fine. thanks so much :slight_smile:

ooooooooops
this should read[AS]this.gotoAndStop(1);
[/AS]

:-\

oh, i was thinking you’d made a typo. yeah, that’s the exact code from the tutorial now. i did it over and over and still had the same problem. oh well… i will do it again. thanks for your time.

care to check out my “dynamic JPGs only load on odd-numbered clicks” thread? :stuck_out_tongue:

err, i noticed that it’s gotoAndStop(1) instead of gotoAndPlay… so it’s not the same exact code. i will swap that out and report back.

this is the strangest thing…

the problem was actually with the HTML. the HTML exported from Flash is somehow causing the SWF to crash the browser when i do “Publish” and have it export the SWF at the same time.

example: let’s say i have a file called 1.fla with all the preloader code, main movie on frame 3, etc. i publish 1.htm and 1.swf. when i view 1.htm it crashes. if i save the same FLA as 2.fla and then export 2.htm and 2.swf it will also crash. but - believe it or not - if i edit 2.htm to include 1.swf instead of 2.swf IT WORKS. it also works if i write my own HTML document. totally weird.

maybe it’s related to the classid that Flash outputs in the HTML file? anyone know what that’s all about?

edit: found this article [ http://www.alistapart.com/stories/flashsatay/ ] that explains the classid. now i know what the problem was with this SWF, and also why it would load (partially) in Firebird and not at all in IE.

thanks again, Claudio, for the support :slight_smile: