This content has been marked as final. Show 9 replies
Use the onLoad method. The onData methods is fired as data arrives and that will vary except at the local level where all data is passed at once.
hmm, I just tried that, and instead of the text from the html file getting displayed, all I get printed in the text box is "true". It must be that success variable when using onLoad. How can I pass the htmlInstructions variable correctly?
I don't know...it still won't work. The only thing I could get printed by screwing around with that code you provided is "instructions.html".
BTW, the problem is that it takes a long time for the text to show up, up to about 10 seconds. I originally thought that it sometimes didn't show up at all.
Slow could be due to data size or something unrelated in Flash code or the network or servers.
Post the source data file (s) you are trying to load if you can.
Sure, the files are at http://homepage.mac.com/nemesis_256/TreasureRacer.zip . The code we're looking at is on frame 1 near the top, under the comment //instructions. The file size is definitely not an issue, it's only about a kilobyte big.
You can play the game to see the problem here: http://homepage.mac.com/nemesis_256/treasureRacer.html . If for some reason you do get the text instantly, try another browser.
There's another problem I have with the preloading. At the bottom of that same frame, you can see that I have loading = this.getBytesLoaded() + container_mc.getBytesLoaded(); and the same for total bytes. the part for the container_mc works when testing in flash, but it won't work when it's online. The purpose of adding that is to make sure the car.swf file is loaded before going to the menu. When loading online, it ignores this, meaning it's possible to try to start the game, but the button for the difficulty level won't do anything until the swf is fully loaded. I can't seem to fix this.
BTW, thanks for all the help.
Just a reminder that I still need help with this. I'll assume you don't come here during the weekends. :)
loadVars is expecting URL format
controls=Move the car forwards and backwards with the up and down keys<br/>Turn left and right using the left and right keys. Either the up or down key must be held down to turn. .... etcRules=A timer is displayed and counts down. If the timer runs out, it's game over!<br/>If the car drives over the grass, it will slow down. You will loose precious time! etc.
Flash does not support the h4 tag. See http://livedocs.macromedia.com/flash/8/main/00001459.html for supported tags.
Has to be all on one line (no returns);
Also some characters may need hex values see: http://en.wikipedia.org/wiki/Url_encoding
Well I ended up putting the html on one line in flash. Looks ugly, but it finally works correctly.
Any idea about the problem with the getBytesLoaded?