Load Family of Images with Modulus

From scripting
Jump to: navigation, search
var myImageHolder = createEmptyMovieClip("myImageHolder", 50);
var $totalImages = 113;    //total minus one
var $randval = int((Math.random()*$totalImages)+1);
myImageHolder.loadMovie("Images/"+$randval+".jpg");
myImageHolder._x = 20;  
myImageHolder._y = 20;
f();
function f() {
    onEnterFrame = function () {
        if (myImageHolder._width) {
            delete this.onEnterFrame; 
			$XDIM = myImageHolder._width ;
			$YDIM = myImageHolder._height ;
			$FinalY = 480//( $FinalX / $XDIM ) * $YDIM ;
			$FinalX = ( $FinalY / $YDIM ) * $XDIM;
			$FPerc = Math.round(100 * ($FinalY / $YDIM));
			myImageHolder._xscale = $FPerc;
			myImageHolder._yscale = $FPerc ;
         }
    };
}