|
|
Question : How to preload gifs in background from xml?
|
|
Hello,
I am adapting another Expert's solution for my application. The code is working fine, however I would like to preload the images, as currently they show up 1 by 1 on the screen, when I would like all 3 to appear at exactly the same time. So, I would like to preload 1 question in advance.....
I am loading the gifs from xml and my code is below. Any help would be greatly appreciated!!!
Many thanks in advance!
CODE:
function populateFields(index:Number):Void{ tTitle.text = aVideos[index].label; tquestion.text = aVideos[index].question; thisSection.text = aVideos[index].thisSection; Anwser.text = aVideos[index].Anwser; thisQuestion.text = aVideos[index].Anwser; trace("picture is " + aVideos[index].image1.data); picture1.loadMovie(aVideos[index].image1, 1); picture2.loadMovie(aVideos[index].image2, 1); picture3.loadMovie(aVideos[index].image3, 1); }
|
Answer : How to preload gifs in background from xml?
|
|
Unfortunately, you can't listen for the picture being fully loaded when using the loadMovie() method. You can only add listeners easily in Actionscript 2.0 using MovieClipLoader.loadClip(). The following is from the Flash help: After you issue the MovieClipLoader.loadClip() command, the following events take place in the order listed:
When the first bytes of the downloaded file have been written to the hard disk, the MovieClipLoader.onLoadStart listener is invoked.
If you have implemented the MovieClipLoader.onLoadProgress listener, it is invoked during the loading process.
Note: You can call MovieClipLoader.getProgress() at any time during the load process.
When the entire downloaded file has been written to the hard disk, the MovieClipLoader.onLoadComplete listener is invoked.
When the downloaded file's first frame actions have been executed, the MovieClipLoader.onLoadInit listener is invoked.
When MovieClipLoader.onLoadInit has been invoked, you can set properties, use methods, and otherwise interact with the loaded movie.
If the file fails to load completely, the MovieClipLoader.onLoadError listener is invoked.
Hope this helps.
|
|
|
|
|