Guest User

Untitled

a guest
Jun 21st, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.51 KB | None | 0 0
  1. function addimage(imageObj) {
  2. var json = new JSON();
  3. var imageHolder:Object = new Object();
  4. var s = json.stringify(imageObj);
  5. trace("json is " + s + " for addimage");
  6. var mcl:MovieClipLoader = new MovieClipLoader();
  7. var mcl_listener:Object = new Object();
  8. mcl.addListener(mcl_listener);
  9. mcl_listener.onLoadInit = function(imageContainer){
  10. // do the scaling now. You'll get proper "final" dimensions
  11. for ( id = 0 ; id < imageObj.length ; id++ ) {
  12. oldWidth = imageHolder[id]._width;
  13. oldHeight = imageHolder[id]._height;
  14. currentX = imageHolder[id]._x;
  15. imageHolder[id]._x = id * (thumbWidth + PADDING);
  16. trace(imageHolder[id]._x + "set x");
  17. aspectRatio = thumbWidth / oldWidth * 100;
  18. thumbHeight = oldHeight / 100 * aspectRatio
  19. imageHolder[id]._width = thumbWidth;
  20. imageHolder[id]._height = thumbHeight;
  21. trace(n._width + " imageHolder[id] width " + aspectRatio);
  22. imageHolder[id].onRollOver = function () {
  23. trace("expanding thumb");
  24. imageHolder[id]._width = oldWidth;
  25. imageHolder[id]._height = oldHeight;
  26. }
  27. imageHolder[id].onRollOut = function() {
  28. trace("shrinking thumb");
  29. imageHolder[id]._width = thumbWidth;
  30. imageHolder[id]._height = thumbHeight;
  31. }
  32.  
  33. }
  34. }
  35. for ( id = 0 ; id < imageObj.length ; id++ ) {
  36. var n = imageHolder[id]
  37. var n:MovieClip = createEmptyMovieClip("imageHolder" + id, 0);
  38. thisUrl = imageObj[id].content[0].value;
  39. mcl.loadClip(thisUrl, n);
  40. trace("clip for " + id + " " + n + " url " + thisUrl); s
  41. }
  42. }
Add Comment
Please, Sign In to add comment