Viewpoint Forums
Viewpoint Forums
Viewpoint Tips, Tricks & Hacks
General Loading Time|
Go
![]() |
New
![]() |
Find
![]() |
Notify
![]() |
Tools
![]() |
Reply
![]() |
|
|
Member |
I used to use a preloader file that would load all the mts files i had then when it would finish would load up the mtx with all the instances and animation. However the alert to show me the loading was finished would come too quickly as the textures had not even been loaded.
I was wondering if there were anyway to signal when the textures are completely loaded and if there were a way to get an alert everytime a texture had finished loading Thanks |
||
|
|
Member |
You could do it this way:
<!-- swf with animation to play while files are loading --> <MTSTimeElem Type="SWFView" Name="my_preloader" PostAnimator="1" Path="myswfpreloader.swf" /> <!-- MTSAction of type LoadMTXStr. Look this up in the XML database (http://developer.viewpoint.com/dc/xml.shtml). It contains MTX code that is not parsed until the action is called. This will absolutely ensure your mts loaders don't do anything until you want them to. --> <MTSAction Name="set_main" Type="LoadMTXStr" > <MTSScene Version="330" > <MTSTimeElem Type="MTSStream" Name="myMTSloader_01" Path="mymts01.mts" /> <MTSTimeElem Type="MTSStream" Name="myMTSloader_02" Path="mymts02.mts" /> <MTSTimeElem Type="MTSImageStream" Name="myImage" Path="lightmap01.jpg" /> <MTSTimeElem Type="SWFView" Name="mySwf" Path="myswf.swf" /> </MTSScene> </MTSAction> <!-- this is the event collector that fires a message after it collects all the events in its list --> <MTSAction Name="load_collect" Type="MTSEventCollection" EventList="MTSLoadDone:myMTSloader_01, MTSLoadDone:myMTSloader_02, MTSLoadDone:myImage, MTSLoadDone:mySwf" Message="allDone"/> <MTSInteractor Name="load_check" > <!-- this handler calls "set_main" action when peloader is finished loading. This ensures the preloader swf animation plays before anything else --> <MTSHandle Event="MTSLoadDone:my_preloader" Action="set_main" /> <!-- after set_main is called, you can pick up each load event like so: --> <MTSHandle Event="MTSLoadDone:myMTSloader_01" Action="MTSJavaScript" Func="alert('mts01_loaded')" /> <MTSHandle Event="MTSLoadDone:myMTSloader_02" Action="MTSJavaScript" Func="alert('mts02_loaded')" /> <MTSHandle Event="MTSLoadDone:myImage" Action="MTSJavaScript" Func="alert('myImage_loaded')" /> <MTSHandle Event="MTSLoadDone:mySwf" Action="MTSJavaScript" Func="alert('mySwf_loaded')" /> <!-- you can also channel each load event into an event collector so that you can have something happen only after EVERYTHING is finished loading: --> <MTSHandle Event="MTSLoadDone:myMTSloader_01" Action="load_collect" /> <MTSHandle Event="MTSLoadDone:myMTSloader_02" Action="load_collect" /> <MTSHandle Event="MTSLoadDone:myImage" Action="load_collect" /> <MTSHandle Event="MTSLoadDone:mySwf" Action="load_collect" /> <!-- this handler can pick up the return message from "load_collect" and do something --> <MTSHandle Event="allDone" Action="some_action" /> </MTSInteractor> Let me know if that works for you. Regards |
|||
|
|
Member |
Thank you for the quick response.
The code works somewhat, but the problem I have now is that if the code becomes too large I start to have difficulty having the flash movie in the beginning load, while if i try to split the preloader and the actual code up I get an error where two objects tend to show up or the objects tend to show up extremely big. |
|||
|
|
Member |
Hmm..can you attach an example project I can look at? Or, if you prefer, you can send it to me in a private message using the new>private message menu item above.
|
|||
|
|
Member |
Hey thanks for the advice once again, I've actually used the example to almost finish the whole loading screen i'm working on and it works great. The only problem I have is now is if the Mtx file is too large then it seems as though IE6 is taking forever just to read the MTX, so when the loading screen comes on it's already about 10 sec after everything else around the MTX has loaded. This happens even when I compress it to a MTZ file. Is there any way I can code a file with just a flash loading screen then have it call the huge mtx i'm trying to load.
Thanks! |
|||
|
|
Member |
Absolutely!
Just use the MTSLoadMTX action (search for MTSLoadMTX in the XML Code Ref). You use this action to load an external mtx file. So you can have your preloader animation in one mtx file, and then call the second huge mtx file after. One thing to keep in mind is your second MTX file that you load in can inheret scene, camera, and even instance and time element settings from the first MTX file, if you want it to, by simply specifying those tags in the first mtx and not in the second. Or your second mtx file can replace these settings simply by specifying its own. Or you can just simply not specify any of these settings in the first, and only specify them in the second. This holds true for third, fourth, fifth, etc. mtx files that you load. Anyway, here's the basic gist. Your first mtx would look something like this: <?xml version="1.0"?> <MTSScene Version="330"> <MTSTimeElem Type="SWFView" PostAnimator="1" Name="myPreloader" Loop="1" /> <MTSInteractor Name="preloadHandler" > <MTSHandle Event="MTSLoadDone:myPreloader" Action="MTSLoadMTX" Path="mySecondMTX.mtx" /> </MTSInteractor> </MTSScene> Regards |
|||
|
| Powered by Eve Community |
| Please Wait. Your request is being processed... |
|
Viewpoint Forums
Viewpoint Forums
Viewpoint Tips, Tricks & Hacks
General Loading Time
