View Full Version : Preloading External JPG
Mark__G
12-28-2007, 10:01 PM
I am trying to use the following tutorial for preloading external images into my gallery but in the example they don't explain how to get the actual preloader to work? I tried using the preload tutorial they recommended but I can't get it to work how I want.
I would prefer something similar to exactly what they have in the example. A preloader that tweens both down and fades out and a fade in tween on the jpg that has been just loaded.
I don't understand the trace command and what it is outputting to? In their example how is the load bar being targeted with that trace command?
Here is the link:
http://www.oman3d.com/tutorials/flash/moviecliploader/
BLiZZaRD
12-29-2007, 06:01 PM
Well, basically you make a preloader. turn that into a movie clip all it's own. ten place it in the image movie you are making. Use the code to load the image and "turn on" the preloaderMC.
trace is only for debugging and will never ever been seen in the finished project. When you are inside Flash and click "control">>"test movie" a little window will come up with errors and script miscues and anything in "trace" command. this is the only time you will see a trace executed.
It is being targeted in this line:
preload.onLoadComplete = function(target){
trace ("Finished Loading!");
}
This says: Movie Clip named "preload" are you done yet? "Yes I am done!" Okay, then we will show the text "Finished Loading!" in the debug window now.
I can give you a few examples of how to do the animations, but I fear Medyman will come in and jump all over me because I like to tween and be in control of my movies instead of relying on code ;) (kidding)
Medyman
12-29-2007, 08:03 PM
I can give you a few examples of how to do the animations, but I fear Medyman will come in and jump all over me because I like to tween and be in control of my movies instead of relying on code ;) (kidding)
LOL.
Don't be scared Blizzard. Feel free to post your examples.
Timeline tweens just aren't my preferred way, that's all. Both ways work...both have their places/uses.
Mark__G
12-31-2007, 09:02 PM
I would appreciate an example. I still can not get the preloader to work properly, I created a preloader and made it into its own movieclip which also contains my image_loader empty movieclip. I also can not figure out how to alpha tween the image_loader movieclip to fade in once the .jpg has finished loading.
Medyman
01-01-2008, 07:39 PM
There are two amazing video tutorials on preloading at www.gotoandlearn.com, if you want to learn more.
They might be of use.
Mark__G
01-02-2008, 08:43 PM
After checking out the tutorial on preloading an external swf I still can not get my preloader to work correctly...
My dynamic text box is not displaying at all?
var mcl:MovieClipLoader = new MovieClipLoader();
var mclL:Object = new Object();
mclL.onLoadProgress = function (target, loaded, total) {
loader.percent.text = Math.round((loaded/total) * 100) + "%";
loader.bar_mc._xscale = Math.round((loaded/total) * 100);
}
mclL.onLoadInit = function() {
loader._visible = false;
loader.percent.text = "";
}
mcl.addListener(mclL);
loader._visible = true;
mcl.loadClip("photos/weddings_big_1.jpg",img_container);
I have all my instance names correct, but still nothing?
Also I still need to figure out how to alpha tween fade in the jpg img once it has been loaded.
Medyman
01-03-2008, 06:28 AM
It's hard to diagnose the problem without the actual source files. At first glance, your code looks fine.
My first guess as to why the dynamic text field is not showing up would be the font. Try embedding the font and see if that helps.
For the alpha tween, use mcTween.
#include "mc_tween2.as"
MC.alphaTo(alpha%, time in seconds, "linear")
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.