Published in: ActionScript
This is a quick way to fade in an image while it is dynamically loading. MovieClipLoader is a powerful class that can also show loading progress and load completion so it's worth looking into if you need something more powerful.
/************************ Import Classes ************************/ import mx.transitions.Tween; import mx.transitions.easing.*; /************************ Fade in JPG ************************/ MovieClip.prototype.FadeAlpha = function(url:String, direction:String) { //A. You can either fade "IN" or "OUT" if (direction == "IN") { //B. MovieClipLoader is far more powerful than loadMovie() var mcLoader:MovieClipLoader = new MovieClipLoader(); mcLoader.loadClip(url, this); var tw:Tween = new Tween(this, "_alpha", Strong.easeOut, 0, 100, 50, false); } else { var tw:Tween = new Tween(this, "_alpha", Strong.easeOut, 100, 0, 50, false); } }; //Create a new MovieClip, load .JPG, and FadeIN var container_mc:MovieClip = this.createEmptyMovieClip("container_mc", this.getNextHighestDepth()); container_mc.FadeAlpha("http://capefeare.com/ralphdrip_small.gif", "IN");
You need to login to post a comment.
