Guest User

Untitled

a guest
Jun 21st, 2018
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.26 KB | None | 0 0
  1. function addimage (loadUrl,id) {
  2. trace("1addImage called for id " + id);
  3. var mcl:MovieClipLoader = new MovieClipLoader();
  4. var mcl_listener:Object = new Object();
  5. mcl_listener.onLoadInit = function(imageHolder){
  6. trace("current image container is " + imageHolder);
  7. // do the scaling now. You'll get proper "final" dimensions
  8. oldWidth = imageHolder._width;
  9. oldHeight = imageHolder._height;
  10. thumbWidth = 150;
  11. aspectRatio = thumbWidth / oldWidth * 100;
  12. thumbHeight = oldHeight / 100 * aspectRatio
  13. imageHolder._width = thumbWidth;
  14. imageHolder._height = thumbHeight;
  15. trace(imageHolder._width + " imageHolder width " + aspectRatio);
  16. imageHolder.onRollOver = function () {
  17. trace("expanding thumb");
  18. imageHolder._width = oldWidth;
  19. imageHolder._height = oldHeight;
  20. }
  21. imageHolder.onRollOut = function() {
  22. trace("shrinking thumb");
  23. imageHolder._width = thumbWidth;
  24. imageHolder._height = thumbHeight;
  25. }
  26. }
  27. mcl.addListener(mcl_listener);
  28. for ( i = 0 ; i <= data.image.length ; i++ ) {
  29. var mcl_listener[i]:Object = new Object();
  30. mcl.addListener(mcl_listener[i]);
  31. var imageHolder:MovieClip = createEmptyMovieClip('imageHolder' + id, imageContainer.getNextHighestDepth());
  32. mcl.loadClip(loadUrl, imageHolder);
  33. }
  34. }
Add Comment
Please, Sign In to add comment