
1. Re: Element width vs Height
davebelais May 1, 2010 2:33 PM (in response to MythProd2010)Width and height aren't static attributes, when you set the width or height properties Flash measures the bounding box of the Element, then sets the transformation matrix to compensate. Flash does so in a native code operation ( C++ or objective C depending on OS ), and I expect the C class that translates the javascript value is trying to be clever by saving an infinitesimal amount of memory using a less precise number type.
The solution to your problem is to perform your own math in javascript, so that you circumvent the problematic function. You can use document.scaleSelection(), document.transformSelection(), or set the element's matrix attribute directly. Setting the matrix attribute directly you will find to be the most accurate, but a little tricky since the matrices in flash are treated differently according to Element type.

2. Re: Element width vs Height
MythProd2010 May 1, 2010 11:17 PM (in response to davebelais)Thanks, David. Can you give me an example of how I would calculate the matrix for width and height for a movieclip (I'm only using movieclips)? I've been reading over a senocular tutorial here (http://www.senocular.com/flash/tutorials/transformmatrix/) and it sounds like "Scale" may be the portion of the page I want to pay attention to.

3. Re: Element width vs Height
davebelais May 2, 2010 1:50 PM (in response to MythProd2010)1 person found this helpfulFirst get the scale values you need to transform the movie clip by:
var widthMultiple=desiredWidth/element.width;
var heightMultiple=desiredHeight/element.height;
You probably don't need to set the matrix directly, I expect using fl.getDocumentDOM().scaleSelection(widthMultiple, heightMultiple) will do the job, however if you want to do the matrix calculations, I can explain in them briefly:
In flash a transformation matrix is really a 2x2 matrix ( the default being {a:1,b:0,c:0,d:1} ) with a registration point ({tx:0,ty:0}).
(matrix.a,matrix.b) is the vector for the x axis. (matrix.c,matrix.d) is the vector defining the y axis.
That just means that moving 1 unit along the x axis is equal to moving a units along the x axis and b units along the y axis in the element's parent's coordinate space, and that moving 1 unit along the y axis is equal to moving c units along the x axis and d units along the y axis in the element's parent's coordinate space. The registration point (tx,ty) is the location of the elements origin/registration point in it's parent's coordinate space.
So long as the vectors (a,b) & (c,d) are tangent to one another, flash will show a rotation value in the transformation panel, otherwise flash will display a skew value. Scale is determined by the length of (a,b) and (c,d). So the square root of ( a^{2} + b^{2}) is scaleX and the square root of ( c^{2} + d^{2}) is scaleY. The scaleX and scaleY values of an element are not necessarily directly proportional to it's width and height, however, which are measured in the element's parent's coordinate space.
What you want to do in order to scale the matrix in it's parent's coordinate space is to concatenate it with a new matrix which has just the desired transformation. An untransformed matrix is {a:1,b:0,c:0,d:1,tx:0,ty:0}, so to double the width of an element you would concatenate it's matrix with {a:2,b:0,c:0,d:1,tx:0,ty:0}. To double the height, concatenate it with {a:1,b:0,c:0,d:2,tx:0,ty:0}. You can use fl.Math.concatMatrix() for this. Your calculation would be:
element.matrix=fl.Math.concatMatrix(element.matrix,{a:widthMultiple,b:0,c:0,d:heightMultiple,tx:0,ty:0});
You can also use document.setSelectionBounds() to set the width and height.

4. Re: Element width vs Height
MythProd2010 May 2, 2010 9:51 PM (in response to davebelais)Brilliant! I appreciate the great info on matrix calculations as well as the heads up on fl.getDocumentDOM().scaleSelection(widthMultiple, heightMultiple). That worked a treat!
Being new to Adobe's new forum software I meant to mark this answer as "correct" instead of just helpful. My apologies on that. If it's possible to change that after the fact let me know and I will.
Thanks a bunch!