# Image zoom actionscript problem

**URL:** <https://forum.kirupa.com/t/image-zoom-actionscript-problem/299617>\
**Category:** Uncategorized\
**Created:** [November 8, 2009, 10:40am UTC](https://forum.kirupa.com/t/image-zoom-actionscript-problem/299617 "2009-11-08T10:40:42Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![iamzacky](https://avatars.discourse-cdn.com/v4/letter/i/ba8739/32.png) [@iamzacky](https://forum.kirupa.com/u/iamzacky)\
**Post date:** [November 8, 2009, 10:40am UTC](https://forum.kirupa.com/t/image-zoom-actionscript-problem/299617/1 "2009-11-08T10:40:42Z")

</div>

hi there…

i have to continue some other guy’s work on this project about landscaping.

**the mechanism**  
the image (instance: pic) is a movieclip positioned outside the frame, and when you click inside all the picture is there. when ctrl+enter, it will automatically sorted inside the frame.

**how it suppose to work**  
the page shows thumbnail of pictures and when people click, it will enlarge.

**how it works now**  
the picture is sorted inside the frame but nothing happen when clicked

i am a bit confused on his actionscript because it has no error whatsoever. so its hard for a newbie like me to identify what is wrong with it. below is the actionscript for your viewing pleasure.

```auto

import gs.TweenLite;
var stg:MovieClip = this;
var viewImg:Boolean = false;

function toDuplicate(){
    pic.stop();
    var totalPic = pic._totalframes;

    for(i=0; i<totalPic; i++){

        var mc:MovieClip = pic.duplicateMovieClip("img" + i, i);

        var col = i%3;        
        var row = Math.floor(i/3);

        //trace("ROW: " + row);
        mc._x = col * (mc._width+20)+155;
        mc._y = row * (mc._height+5)+140;
        
        mc.oriX = mc._x;
        mc.oriY = mc._y;
        
        mc.gotoAndStop(i+1);
        
        TweenLite.from(mc, 0.8,{delay:(i*0.1), _alpha:0, _y:"20", onComplete:initRoll, onCompleteParams:[mc], ease:mx.transitions.easing.Back.easeOut});        
    }
}

function initRoll(mc){

    mc.onRollOver = function(){
        if(!viewImg){
            TweenLite.to(this, 0.5,{_xscale:50, _yscale:50, ease:mx.transitions.easing.Back.easeOut});
            if(!viewImg){
                mc.swapDepths(stg.getNextHighestDepth());
                soundLoader.attachSound("bubble");
                soundLoader.start();
            }
        }
    }    
    mc.onRollOut = mc.onReleaseOutside = function(){
        if(!viewImg){
            TweenLite.to(this, 0.8,{_xscale:40, _yscale:40, ease:mx.transitions.easing.Back.easeIn});
        }
    }
    
    mc.onRelease = showImg;
}

function showImg(){
    if(!viewImg){

        viewImg = true;
        this.onRelease = closeImg;
    
        delete this.onRollOver;
        delete this.onRollOut;
        delete this.onReleaseOutside;
    
        TweenLite.to(this, 0.5,{_x:Stage.width/2, _y:Stage.height/2, _xscale:100, _yscale:100});

    }
}

function closeImg(){
    viewImg = false;
    this.onRelease = showImg;
    TweenLite.to(this, 0.5,{_x:this.oriX, _y:this.oriY, _xscale:40, _yscale:40, onComplete:initRoll, onCompleteParams:[this]});
}

toDuplicate();

```

thanks in advance
