Re: [Flashcoders] Random incriments [AS3]

2008-05-01 Thread Glen Pike

Hi,

   This is possibly due to rounding errors.

   If you want the components to remain the same size, you should set 
the size of one using the size of the other...


   selectedImage.width *= 1.1;
   imgWidthVar = selectedImage.width;

   etc.

   Glen

SJM - Flash wrote:

Hi Guys

Im writing an application where you can manipulate images increse/decrease size rotate flip etc... but i need to keep the actual image size in memory for outputing (following on to my 'Reading position info X, Y, H  W' question). 


Im trying to set the values for the actual image so when its rotated i still 
have the correct height and width to output (as the box width/height will now 
be bigger than the image height/width).

The height and width are both set from the same XML source; W: 100  H: 80

// START OF FLOW

Push the increase button, here is the code from the button

 selectedImage.width *= 1.1;
 selectedImage.height *= 1.1;
 imgWidthVar *= 1.1;
 imgHeightVar *= 1.1;


The image and bounding MC change in size, here is the Trace info of the values 
(please note there has been no rotation)...

 IMGAGE W: 110 H: 88
 BOX W: 110 H: 88

 IMGAGE W: 121 H: 96
 BOX W: 121 H: 96.81

 IMGAGE W: 133 H: 105
 BOX W: 133.1 H: 106.5

 IMGAGE W: 146 H: 115
 BOX W: 146.4 H: 117.15

// END OF FLOW

Whats going wrong? Both image and box H/W should be identical

Thanks in advance
SJM
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


  


--

Glen Pike
01326 218440
www.glenpike.co.uk http://www.glenpike.co.uk

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Random incriments [AS3]

2008-05-01 Thread SJM - Flash
Hi Glen thanks for your reply, this is a continuation really from what you told 
me about Pythagoras to do this i need the actual image height and width.

Normally i would do it this way but when the selected image is rotated 
selectedImage will be wider than imageWidth and will not output the correct 
information.

SJM
  - Original Message - 
  From: Glen Pike 
  To: Flash Coders List 
  Sent: Thursday, May 01, 2008 1:53 PM
  Subject: Re: [Flashcoders] Random incriments [AS3]


  Hi,

  This is possibly due to rounding errors.

  If you want the components to remain the same size, you should set 
  the size of one using the size of the other...

  selectedImage.width *= 1.1;
  imgWidthVar = selectedImage.width;

  etc.

  Glen

  SJM - Flash wrote:
   Hi Guys
  
   Im writing an application where you can manipulate images increse/decrease 
size rotate flip etc... but i need to keep the actual image size in memory for 
outputing (following on to my 'Reading position info X, Y, H  W' question). 
  
   Im trying to set the values for the actual image so when its rotated i 
still have the correct height and width to output (as the box width/height will 
now be bigger than the image height/width).
  
   The height and width are both set from the same XML source; W: 100  H: 80
  
   // START OF FLOW
  
   Push the increase button, here is the code from the button
  
selectedImage.width *= 1.1;
selectedImage.height *= 1.1;
imgWidthVar *= 1.1;
imgHeightVar *= 1.1;
  
  
   The image and bounding MC change in size, here is the Trace info of the 
values (please note there has been no rotation)...
  
IMGAGE W: 110 H: 88
BOX W: 110 H: 88
  
IMGAGE W: 121 H: 96
BOX W: 121 H: 96.81
  
IMGAGE W: 133 H: 105
BOX W: 133.1 H: 106.5
  
IMGAGE W: 146 H: 115
BOX W: 146.4 H: 117.15
  
   // END OF FLOW
  
   Whats going wrong? Both image and box H/W should be identical
  
   Thanks in advance
   SJM
   ___
   Flashcoders mailing list
   Flashcoders@chattyfig.figleaf.com
   http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
  
  
 

  -- 

  Glen Pike
  01326 218440
  www.glenpike.co.uk http://www.glenpike.co.uk

  ___
  Flashcoders mailing list
  Flashcoders@chattyfig.figleaf.com
  http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Random incriments [AS3]

2008-05-01 Thread Glen Pike

Hi,

   I am a bit confused as to what you want to do...

   If you rotate the image, I think it will return the width and height 
of it's bounding box, but I think you are saying you want to shrink the 
bounding box so it matches your original size???  - If you do this, you 
will shrink the image too.


   I am guessing you are trying to store your original unrotated 
width and height of the image for later?


   But you can calculate your actual image size from the bounding box 
values you have too...


   From your diagram - I think you have X2 and X on the wrong axis - 
but using your variables and assuming 0, 0 is at the bottom left hand 
corner (it may not be in the Flash Player):


   w2 = Math.sqrt( (WIDTH - Y) * (WIDTH - Y) + (X2 * X2));

   h2 = Math.sqrt(Y * Y + (HEIGHT - X2) * (HEIGHT - X2));

   Look at Proof #4 on this page if you want to see what I mean.

   http://www.cut-the-knot.org/pythagoras/index.shtml

   HTH

   Glen
  


SJM - Flash wrote:

Hi Glen thanks for your reply, this is a continuation really from what you told 
me about Pythagoras to do this i need the actual image height and width.

Normally i would do it this way but when the selected image is rotated 
selectedImage will be wider than imageWidth and will not output the correct 
information.

SJM
  - Original Message - 
  From: Glen Pike 
  To: Flash Coders List 
  Sent: Thursday, May 01, 2008 1:53 PM

  Subject: Re: [Flashcoders] Random incriments [AS3]


  Hi,

  This is possibly due to rounding errors.

  If you want the components to remain the same size, you should set 
  the size of one using the size of the other...


  selectedImage.width *= 1.1;
  imgWidthVar = selectedImage.width;

  etc.

  Glen

  SJM - Flash wrote:
   Hi Guys
  
   Im writing an application where you can manipulate images increse/decrease size rotate flip etc... but i need to keep the actual image size in memory for outputing (following on to my 'Reading position info X, Y, H  W' question). 
  

   Im trying to set the values for the actual image so when its rotated i 
still have the correct height and width to output (as the box width/height will 
now be bigger than the image height/width).
  
   The height and width are both set from the same XML source; W: 100  H: 80
  
   // START OF FLOW
  
   Push the increase button, here is the code from the button
  
selectedImage.width *= 1.1;
selectedImage.height *= 1.1;
imgWidthVar *= 1.1;
imgHeightVar *= 1.1;
  
  
   The image and bounding MC change in size, here is the Trace info of the 
values (please note there has been no rotation)...
  
IMGAGE W: 110 H: 88
BOX W: 110 H: 88
  
IMGAGE W: 121 H: 96
BOX W: 121 H: 96.81
  
IMGAGE W: 133 H: 105
BOX W: 133.1 H: 106.5
  
IMGAGE W: 146 H: 115
BOX W: 146.4 H: 117.15
  
   // END OF FLOW
  
   Whats going wrong? Both image and box H/W should be identical
  
   Thanks in advance
   SJM
   ___
   Flashcoders mailing list
   Flashcoders@chattyfig.figleaf.com
   http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
  
  
 

  -- 


  Glen Pike
  01326 218440
  www.glenpike.co.uk http://www.glenpike.co.uk

  ___
  Flashcoders mailing list
  Flashcoders@chattyfig.figleaf.com
  http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


  


--

Glen Pike
01326 218440
www.glenpike.co.uk http://www.glenpike.co.uk

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Random incriments [AS3]

2008-05-01 Thread SJM - Flash
Glen, no i do not want to shrink the image i just want to maintain the original 
valuesthen calculate the increas/decreas info (ie original W 100, H 80 + [1 
click] = W 110, H 90) so i can use Pythagoras in asp to do its job as you 
mentioned!!

  ... I am guessing you are trying to store your original unrotated width 
and height of the image for later?...

Yes i am, I am also tring to multiply the value at the sametime so i can output 
W2  H2

  ... From your diagram - I think you have X2 and X on the wrong axis - but 
using your variables and assuming 0, 0 is at the bottom left hand corner... 

0,0 is the XY point (top right of actual photo), X2 does not exist and i can 
not get the information, if i could then it would be great!

Thanks agin for your help!
SJM
  - Original Message - 
  From: Glen Pike 
  To: Flash Coders List 
  Sent: Thursday, May 01, 2008 3:02 PM
  Subject: Re: [Flashcoders] Random incriments [AS3]


  Hi,

  I am a bit confused as to what you want to do...

  If you rotate the image, I think it will return the width and height 
  of it's bounding box, but I think you are saying you want to shrink the 
  bounding box so it matches your original size???  - If you do this, you 
  will shrink the image too.

  I am guessing you are trying to store your original unrotated 
  width and height of the image for later?

  But you can calculate your actual image size from the bounding box 
  values you have too...

  From your diagram - I think you have X2 and X on the wrong axis - 
  but using your variables and assuming 0, 0 is at the bottom left hand 
  corner (it may not be in the Flash Player):

  w2 = Math.sqrt( (WIDTH - Y) * (WIDTH - Y) + (X2 * X2));

  h2 = Math.sqrt(Y * Y + (HEIGHT - X2) * (HEIGHT - X2));

  Look at Proof #4 on this page if you want to see what I mean.

  http://www.cut-the-knot.org/pythagoras/index.shtml

  HTH

  Glen
 

  SJM - Flash wrote:
   Hi Glen thanks for your reply, this is a continuation really from what you 
told me about Pythagoras to do this i need the actual image height and width.
  
   Normally i would do it this way but when the selected image is rotated 
selectedImage will be wider than imageWidth and will not output the correct 
information.
  
   SJM
 - Original Message - 
 From: Glen Pike 
 To: Flash Coders List 
 Sent: Thursday, May 01, 2008 1:53 PM
 Subject: Re: [Flashcoders] Random incriments [AS3]
  
  
 Hi,
  
 This is possibly due to rounding errors.
  
 If you want the components to remain the same size, you should set 
 the size of one using the size of the other...
  
 selectedImage.width *= 1.1;
 imgWidthVar = selectedImage.width;
  
 etc.
  
 Glen
  
 SJM - Flash wrote:
  Hi Guys
 
  Im writing an application where you can manipulate images 
increse/decrease size rotate flip etc... but i need to keep the actual image 
size in memory for outputing (following on to my 'Reading position info X, Y, H 
 W' question). 
 
  Im trying to set the values for the actual image so when its rotated i 
still have the correct height and width to output (as the box width/height will 
now be bigger than the image height/width).
 
  The height and width are both set from the same XML source; W: 100  H: 
80
 
  // START OF FLOW
 
  Push the increase button, here is the code from the button
 
   selectedImage.width *= 1.1;
   selectedImage.height *= 1.1;
   imgWidthVar *= 1.1;
   imgHeightVar *= 1.1;
 
 
  The image and bounding MC change in size, here is the Trace info of the 
values (please note there has been no rotation)...
 
   IMGAGE W: 110 H: 88
   BOX W: 110 H: 88
 
   IMGAGE W: 121 H: 96
   BOX W: 121 H: 96.81
 
   IMGAGE W: 133 H: 105
   BOX W: 133.1 H: 106.5
 
   IMGAGE W: 146 H: 115
   BOX W: 146.4 H: 117.15
 
  // END OF FLOW
 
  Whats going wrong? Both image and box H/W should be identical
 
  Thanks in advance
  SJM
  ___
  Flashcoders mailing list
  Flashcoders@chattyfig.figleaf.com
  http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
 
 

  
 -- 
  
 Glen Pike
 01326 218440
 www.glenpike.co.uk http://www.glenpike.co.uk
  
 ___
 Flashcoders mailing list
 Flashcoders@chattyfig.figleaf.com
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
   ___
   Flashcoders mailing list
   Flashcoders@chattyfig.figleaf.com
   http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
  
  
 

  -- 

  Glen Pike
  01326 218440
  www.glenpike.co.uk http://www.glenpike.co.uk

Re: [Flashcoders] Random incriments [AS3]

2008-05-01 Thread Glen Pike

Hi,

   You can do some trigonometry to get the missing dimensions.

   The distance from 0, 0, to X,0 - top corner of your image = X2, the 
distance from 0,0 to 0, Y - the LH corner of your image = Y2:
  
   theta = selectedImage._rotation * Math.Pi / 180; //(How much your 
image is rotated in radians).
  
   X2 = _selectedImage._height * Math.sin(theta);

   Y2 = _selectedImage._height * Math.cos(theta);

   Glen

SJM - Flash wrote:

Glen, no i do not want to shrink the image i just want to maintain the original 
valuesthen calculate the increas/decreas info (ie original W 100, H 80 + [1 
click] = W 110, H 90) so i can use Pythagoras in asp to do its job as you 
mentioned!!

  ... I am guessing you are trying to store your original unrotated width 
and height of the image for later?...

Yes i am, I am also tring to multiply the value at the sametime so i can output W2 
 H2

  ... From your diagram - I think you have X2 and X on the wrong axis - but using your variables and assuming 0, 0 is at the bottom left hand corner... 


0,0 is the XY point (top right of actual photo), X2 does not exist and i can 
not get the information, if i could then it would be great!

Thanks agin for your help!
SJM
  - Original Message - 
  From: Glen Pike 
  To: Flash Coders List 
  Sent: Thursday, May 01, 2008 3:02 PM

  Subject: Re: [Flashcoders] Random incriments [AS3]


  Hi,

  I am a bit confused as to what you want to do...

  If you rotate the image, I think it will return the width and height 
  of it's bounding box, but I think you are saying you want to shrink the 
  bounding box so it matches your original size???  - If you do this, you 
  will shrink the image too.


  I am guessing you are trying to store your original unrotated 
  width and height of the image for later?


  But you can calculate your actual image size from the bounding box 
  values you have too...


  From your diagram - I think you have X2 and X on the wrong axis - 
  but using your variables and assuming 0, 0 is at the bottom left hand 
  corner (it may not be in the Flash Player):


  w2 = Math.sqrt( (WIDTH - Y) * (WIDTH - Y) + (X2 * X2));

  h2 = Math.sqrt(Y * Y + (HEIGHT - X2) * (HEIGHT - X2));

  Look at Proof #4 on this page if you want to see what I mean.

  http://www.cut-the-knot.org/pythagoras/index.shtml

  HTH

  Glen
 


  SJM - Flash wrote:
   Hi Glen thanks for your reply, this is a continuation really from what you 
told me about Pythagoras to do this i need the actual image height and width.
  
   Normally i would do it this way but when the selected image is rotated 
selectedImage will be wider than imageWidth and will not output the correct 
information.
  
   SJM
 - Original Message - 
 From: Glen Pike 
 To: Flash Coders List 
 Sent: Thursday, May 01, 2008 1:53 PM

 Subject: Re: [Flashcoders] Random incriments [AS3]
  
  
 Hi,
  
 This is possibly due to rounding errors.
  
 If you want the components to remain the same size, you should set 
 the size of one using the size of the other...

  
 selectedImage.width *= 1.1;
 imgWidthVar = selectedImage.width;
  
 etc.
  
 Glen
  
 SJM - Flash wrote:
  Hi Guys
 
  Im writing an application where you can manipulate images increse/decrease size rotate flip etc... but i need to keep the actual image size in memory for outputing (following on to my 'Reading position info X, Y, H  W' question). 
 

  Im trying to set the values for the actual image so when its rotated i 
still have the correct height and width to output (as the box width/height will now 
be bigger than the image height/width).
 
  The height and width are both set from the same XML source; W: 100  H: 
80
 
  // START OF FLOW
 
  Push the increase button, here is the code from the button
 
   selectedImage.width *= 1.1;
   selectedImage.height *= 1.1;
   imgWidthVar *= 1.1;
   imgHeightVar *= 1.1;
 
 
  The image and bounding MC change in size, here is the Trace info of the 
values (please note there has been no rotation)...
 
   IMGAGE W: 110 H: 88
   BOX W: 110 H: 88
 
   IMGAGE W: 121 H: 96
   BOX W: 121 H: 96.81
 
   IMGAGE W: 133 H: 105
   BOX W: 133.1 H: 106.5
 
   IMGAGE W: 146 H: 115
   BOX W: 146.4 H: 117.15
 
  // END OF FLOW
 
  Whats going wrong? Both image and box H/W should be identical
 
  Thanks in advance
  SJM
  ___
  Flashcoders mailing list
  Flashcoders@chattyfig.figleaf.com
  http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
 
 

  
 -- 
  

 Glen Pike
 01326 218440
 www.glenpike.co.uk http://www.glenpike.co.uk