
I have recently created a game in Flash CS3 with AS3 which displays a random picture (this is a pretty integral part of the game).
I have written a small procedure to resize the picture to an appropriate size for the flash application. This is as follows:
function onComplete(ev:Event):void { var maxheight = 240; var maxwidth = 400; var l1:LoaderInfo = LoaderInfo(ev.target); trace(“width” + l1.content.width) trace(“height” + l1.content.height) var lheight = l1.content.height; var lwidth = l1.content.width; while ((lheight > maxheight) || (lwidth > maxwidth)){ if (lheight-maxheight >= lwidth-maxwidth) { lwidth = (maxheight / lheight) * lwidth; lheight = maxheight; } else { lheight = (maxwidth / lwidth) * lheight; lwidth = maxwidth; } } l1.content.width = lwidth; l1.content.height = lheight; }
This resizes the picture when it is fully loaded. This seems to work fine on my own site, but on the sites to which mochi ads has distributed it, it doesn’t resize the image at all, even if it is left to fully load.
Does anyone know why this might be the case?
If you would like to make a comment, please fill out the form below.
Recent Comments