Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function addimage(imageObj) {
- var json = new JSON();
- var imageHolder:Object = new Object();
- var s = json.stringify(imageObj);
- trace("json is " + s + " for addimage");
- var mcl:MovieClipLoader = new MovieClipLoader();
- var mcl_listener:Object = new Object();
- mcl.addListener(mcl_listener);
- mcl_listener.onLoadInit = function(imageContainer){
- // do the scaling now. You'll get proper "final" dimensions
- for ( id = 0 ; id < imageObj.length ; id++ ) {
- oldWidth = imageHolder[id]._width;
- oldHeight = imageHolder[id]._height;
- currentX = imageHolder[id]._x;
- imageHolder[id]._x = id * (thumbWidth + PADDING);
- trace(imageHolder[id]._x + "set x");
- aspectRatio = thumbWidth / oldWidth * 100;
- thumbHeight = oldHeight / 100 * aspectRatio
- imageHolder[id]._width = thumbWidth;
- imageHolder[id]._height = thumbHeight;
- trace(n._width + " imageHolder[id] width " + aspectRatio);
- imageHolder[id].onRollOver = function () {
- trace("expanding thumb");
- imageHolder[id]._width = oldWidth;
- imageHolder[id]._height = oldHeight;
- }
- imageHolder[id].onRollOut = function() {
- trace("shrinking thumb");
- imageHolder[id]._width = thumbWidth;
- imageHolder[id]._height = thumbHeight;
- }
- }
- }
- for ( id = 0 ; id < imageObj.length ; id++ ) {
- var n = imageHolder[id]
- var n:MovieClip = createEmptyMovieClip("imageHolder" + id, 0);
- thisUrl = imageObj[id].content[0].value;
- mcl.loadClip(thisUrl, n);
- trace("clip for " + id + " " + n + " url " + thisUrl); s
- }
- }
Add Comment
Please, Sign In to add comment