Posted By

chrisaiv on 02/20/07


Tagged

MovieClipLoader FadeAlphaIn as2


Versions (?)

Who likes this?

9 people have marked this snippet as a favorite

Hirmine
juliecutey
gasface
arala22
digitalifer
ninedaysoff
mrjthethird
dbrouse
greguarr


AS2: Dynamically load image + FadeAlphaIn


 / 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.

  1. /************************
  2. Import Classes
  3. ************************/
  4. import mx.transitions.Tween;
  5. import mx.transitions.easing.*;
  6. /************************
  7. Fade in JPG
  8. ************************/
  9. MovieClip.prototype.FadeAlpha = function(url:String, direction:String) {
  10. //A. You can either fade "IN" or "OUT"
  11. if (direction == "IN")
  12. {
  13. //B. MovieClipLoader is far more powerful than loadMovie()
  14. var mcLoader:MovieClipLoader = new MovieClipLoader();
  15. mcLoader.loadClip(url, this);
  16. var tw:Tween = new Tween(this, "_alpha", Strong.easeOut, 0, 100, 50, false);
  17. } else
  18. {
  19. var tw:Tween = new Tween(this, "_alpha", Strong.easeOut, 100, 0, 50, false);
  20. }
  21. };
  22. //Create a new MovieClip, load .JPG, and FadeIN
  23. var container_mc:MovieClip = this.createEmptyMovieClip("container_mc", this.getNextHighestDepth());
  24. container_mc.FadeAlpha("http://capefeare.com/ralphdrip_small.gif", "IN");

Report this snippet  

Comments

RSS Icon Subscribe to comments
Posted By: mjadhav27gmailcom on October 31, 2009

thanks for

You need to login to post a comment.