flash scale ?
- Started
- Last post
- 10 Responses
- lvl_13
okay, this is probably real easy but...
i got an mc that has this code:onClipEvent (load) {
this._x=(random(700)+50);
this._y=(random(575)+25);}
onClipEvent (enterFrame) {
this._width=(random(5)+200);
this._height=(random(5)+200);
}now, i just can't seem to figure out how to keep the mc in correct proportions, meaning if _height scales 95% i want _width to scale 95% as well.
I would think it would just be as easy as creating a new variable that is as simple as something like this:
newsize=_height+_width;
and change the clip event code to read:
onClipEvent (load) {
this._x=(random(700)+50);
this._y=(random(575)+25);}
onClipEvent (enterFrame) {
this._newsize=(random(5)+200);
}no go though. can anybody help me out with this. it's probably something so simple that i am just overlooking. thanks in adv.
- JazX0
not sure exactly, but you might want to search this dB, because I could have sworn unfittoprint answered this a bunch of times.
- lvl_130
okay cool. thanks jazx. in case anyone has an answer for me before i get through unfits posts please feel free. thanks.
- kpl0
to keep proportions, make one dimension the function of another. ie. set the _height so that it will always be 90% of the _width.
ie.
this._width = blah blah;
this._height = .9 * this._width;
- unformatted0
that's because you're pulling 2 random numbers for width and height
this._width = random stuff;
this._height = this._width;i would use _yscale and _xscale anyway.
- fugged0
why not use xscale and yscale?
scale = Math.random()*100;
clip._xscale = scale;
clip._yscale = scale;?
- JazX0
yeah can't ya like search under his name and the word scale, something is there :)
- kpl0
you ever use search? damn easier typing the whole thing out.
- lvl_130
doh! of course. thanks guys, i appreciate the fast help.
- JazX0
I just kinda' figured this might have been there. :)
- MX_OnD0
as already stated....
scaleAmount = (Math.random()*100)
myMovieClip._xscale = scaleAmount;
myMovieClip._yscale = scaleAmount;