[COLOR=black][FONT=Arial]I’m currently working on a project with custom cursors within an application which scales proportionately to fit the browser window.[/FONT][/COLOR]
[COLOR=black][FONT=Arial]The custom cursors also scale and the result is less then pleasing. [/FONT][/COLOR]
[COLOR=black][FONT=Arial] [/FONT][/COLOR]
[COLOR=black][FONT=Arial]I’ve written a function which returns the stages scaling amount but when I use that number to rescale the custom cursors in the opposite direction by subtracting the stages scaling amount say 1.5 by 2 it doesn’t seem to work properly. While the cursors do resize in the right direction they seem to be off.[/FONT][/COLOR]
[COLOR=black][FONT=Arial] [/FONT][/COLOR]
[COLOR=black][FONT=Arial]Is there another factor I am missing?[/FONT][/COLOR]
public static function getStageScaleAmount(stage:Stage):Number {
var origStageWidth=750;
var origStageHeight=420;
var origAspectRatio=origStageWidth/origStageHeight;
//need to determin which side it is scaled by
var resizedStageWidth=stage.stageWidth;
var resizedStageHeight=stage.stageHeight;
var resizedAspectRatio=resizedStageWidth/resizedStageHeight;
//
var scaleAmount;
//
if (resizedAspectRatio<origAspectRatio) {
//scaled to width
scaleAmount=resizedStageWidth/origStageWidth;
} else {
scaleAmount=resizedStageHeight/origStageHeight;
}
if (isNaN(scaleAmount)) {
scaleAmount=1;
}
return scaleAmount;
}