|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
preloading a mc
How do you do it?
I have been trying to use similiar to the following as }totalBytes = Math.round(getBytesTotal() / 1024); loadedBytes = Math.round(getBytesLoaded() / 1024); percentDone = Math.round((loadedBytes / totalBytes) * 100); if (_root._framesloaded >= _root._totalframes) { gotoAndPlay("start"); } onClipEvent (enterFrame) { _xscale = _root.percentDone; onClipEvent (enterFrame) { I have been changing the }_root{ to }this.container.{ etc... Where am I going wrong? Thanks |
|
#2
|
|||
|
|||
|
Hi, its a little hard to tell what you mean exactly. I'm going to guess your tying to preload your main movie. Last time I made a preloader I used two scenes. Looks like your doing it off a movie clip that may be in the root of the main scene. Thats a nice idea.
onClipEvent(enterFrame) { totalBytes = Math.round(getBytesTotal() / 1024); loadedBytes = Math.round(getBytesLoaded() / 1024); percentDone = Math.round((loadedBytes / totalBytes) * 100); if (percentDone >= 95) { gotoAndPlay("start"); } } That should work depending on your implementation. |
|
#3
|
|||
|
|||
|
Hi Tann
Sorry for not explaining properly so what i'm doing is loading my main scene and I want to load each individual mc seperately. So instead of waiting for a whole 200kb flash movie to load you only have to wait for each 10-20kb Movieclip. But I want those small clips to preload with some kind of counter. Its not so much which maths I use wether it be time, loaded bytes etc, none of them work becuase when I use the AS above it gotoPlays frame 1 from my Main movie line and not from the movieclip. Please Help, Thanks Ian |
|
#4
|
|||
|
|||
|
Hi,
onClipEvent(enterFrame) { totalBytes = Math.round(getBytesTotal() / 1024); loadedBytes = Math.round(getBytesLoaded() / 1024); percentDone = Math.round((loadedBytes / totalBytes) * 100); if (percentDone >= 95) { this.gotoAndPlay("start"); } } I think that should do it now. |
|
#5
|
|||
|
|||
|
Preloading mc's??? arrgg PLEASE HELP!!!!
Here is the exact AS that i am using!
I have tried with the all the instances of .this changed to .this.container. which were originally _root I have tried it with no .this exept on the gotoAndPlay I had the same preloader on my main movie, so I changed the instance name of the preloader bar and that did not work so I removed the preloader from my main movie altogether. Still no joy. I supected it has something to do with onClipEvent (enterFrame) Maybe its particular to the main movie. What the result is my main movie loads and plays to the point where I want it Stop and the mc stops on frame 1. Whats displaying on frame 1 on the mc is Frames loaded 1 Frames Total 1 Bytes loaded 293 (20kb on disk sized file) Bytes Total 293 all the rest are o with 100% load I will have dozens of mc to load throughout the site and would lrealy like this to work, though the end result of the preloader will be a slimmed version. onClipEvent (enterFrame) { this.hcpreloader.bar._xscale = siteLoaded; siteLoaded = int((loaded_bytes/total_bytes)*100); // bytes total_bytes = this.getBytesTotal(); loaded_bytes = this.getBytesLoaded(); remaining_bytes = total_bytes-loaded_bytes; // frames frame_loaded = this._framesloaded; frame_total = this._totalframes; // kilo bytes totalkb = int(total_bytes/1024) add "KB"; loadedkb = int(loaded_bytes/1024) add "KB"; remaining_kb = int(remaining_bytes/1024); remainingkb = int(remaining_kb) add "KB"; percent_done = int((loaded_bytes/total_bytes)*100) add "%"; // time time = getTimer()/1000; // speed speed = loaded_bytes/time; bits = speed/1024; Kbps = Math.round(bits*10)/10 add "KB/S"; // time remaining kbyteCounter = (total_bytes-loaded_bytes)/1024; loadRate = (loaded_bytes/1024)/time; timeCounter = kbyteCounter/loadRate; minutes = Math.floor(timeCounter/60); seconds = Math.round((timeCounter/60-minutes)*60); time_remaining = minutes+" min "+seconds+" sec"; // timeelapsed minute = Math.floor(time/60); second = Math.round((time/60-minute)*60); time_elapsed = minute+" min "+second+" sec"; if (total_bytes == loaded_bytes) { this.gotoAndPlay(2); } this is on the bar onClipEvent (load) { this._xscale = "0"; } Last edited by mknight : December 2nd, 2003 at 01:46 PM. |
|
#6
|
|||
|
|||
|
Hi, that all seems ok to me. Can you make a snippet of your site. Say make a copy of the flash file and then remove everything except one clip etc...you know so that in the end there is just the preloader and a clip you want it to work with.
Basically can you post something here or send it to me. I'll take a look and get back to you tommorow. |
|
#7
|
|||
|
|||
|
Thankyou Tann
Here is the main (home nag..fla)scene and the its home content.fla Thankyou veru much Ian |
![]() |
| Viewing: Dev Shed Forums > Web Design > Flash Help > preloading a mc |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|