PDA

View Full Version : NEW flash player 6 BUG!


pbjpb
03-28-2003, 03:40 PM
i found a bug in the new flash player 6. if you update your player right now, and try to load a JPG into a MC inside another MC with this code on the inner MC:

onClipEvent (load) {
var pw = _parent._width;
var ph = _parent._height;
var cw = this._width;
var ch = this._height;
this._x = Math.round(pw/2-cw/2);
this._y = Math.round(ph/2-ch/2);
}


it WON'T be centered. it would center on the previous version 6 player. can anyone tell me how to alert macromedia about this??? thanks!

senocular
03-29-2003, 10:09 AM
I think your problem lies in your logic.

If your movieclips start off with nothing in them, then both movieclips have an initial width and height of 0. Once that image is loaded, then the inner movieclip would then have the width and height of the image. ... but so would the outter clip because it contains the inner clip - that inner clip making up the imagery of the outer, just as the loaded bitmap makes up the imagery of the inner. Basically the bitmap is the imagery of both, so both have the width and height of the bitmap. So, if you have two widths which are the same, divide them both by 2 then subtract one from the other and round the value, what do you get? 0. Same with the heights - since they are the same, performing that operation will always be the same.

Centering is usually just a matter of subtracting half the image width and height from the location

this._x = -this._width/2
this._y = -this._height/2