Scaling Movieclip
hoping chris or can me one...
i have background image i'm wanting scale stage.height , stage.width but, keep in proportion well.
for reason, can not figure out.
here's code have far...
i've tried lot of variables on well.
including entering actual width , height of movieclip so...
what missing?
i have background image i'm wanting scale stage.height , stage.width but, keep in proportion well.
for reason, can not figure out.
here's code have far...
quote:
stage.scalemode = "noscale";
stage.align = "tl";
var stagelistener:object = new object ();
stagelistener.onresize = positioncontent;
stage.addlistener(stagelistener);
stagew = stage.width;
stageh = stage.height;
bulbswide = (stagew > lightbulbs._width);
bulbstall = (stageh > lightbulbs._height) && (stagew < lightbulbs._width);
function positioncontent():void {
if (bulbswide) {
lightbulbs._width = stage.width;
lightbulbs._yscale = lightbulbs._xscale;
} else if (bulbstall) {
lightbulbs._height = stage.height;
lightbulbs._xscale = lightbulbs._yscale;
} else {
lightbulbs._width = stage.width;
lightbulbs._yscale = lightbulbs._xscale;
}
}
positioncontent();
i've tried lot of variables on well.
including entering actual width , height of movieclip so...
quote:
bulbswide = (stagew > 811);
bulbstall = (stageh > 592) && (stagew < 811);
what missing?
i think need ternary operator
if have figured out possiblexscale , possibleyscale can assign thescale this:
thescale = (possiblexscale > possibleyscale) ? possiblexscale : possibleyscale;
the 1 above says if possiblexscale larger possibleyscale assign value of possiblexscale thescale.
if wanted other way around either change greater less or change order variables appear after ?.
if have figured out possiblexscale , possibleyscale can assign thescale this:
thescale = (possiblexscale > possibleyscale) ? possiblexscale : possibleyscale;
the 1 above says if possiblexscale larger possibleyscale assign value of possiblexscale thescale.
if wanted other way around either change greater less or change order variables appear after ?.
More discussions in Adobe Animate CC - General
adobe
Comments
Post a Comment