Refrencing the original size of a .jpg

  • DrGonzo
  • Beginner
  • Beginner
  • DrGonzo
  • Posts: 36

Post 3+ Months Ago

Hello all,
I'm using the fileReference class to allow users to load images from their computer into a movie clip. I am also using a custom freeTransform class to allow the user to scale/rotate/move the image/movie clip. The freeTransform class has a sizeRestrict function, which allows you to set xMin, xMax, yMin & yMax values, but this works on a scale of the original image - i.e: xMin:50, xMax:50, yMin:50, yMax:50, restricts the movie clip to 50% of the original jpg size....

What I want to do, is restrict the size of the move clip to specific width & height dimensions - regardless of the jpg's original size...

Does anyone know if there is a way of reading the original dimensions of a jpg? If I could reference these values I can do a sum (desied size/actual size x100) to get the right xMin, xMax, yMin & yMax values for each jpg....

Any help would be greatly appreciated...

Thanks,

DrGonzo.
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • graphixboy
  • Control + Z
  • Mastermind
  • User avatar
  • Posts: 1828
  • Loc: In the Great White North

Post 3+ Months Ago

you can read the size of the movieclip target as soon as the picture is loaded into it and then store that data. I would however make sure you create an empty movieclip as the target so that you can get an actual dimension from what is loaded into it instead of what the size was previously.

For example
Code: [ Select ]
listener.onComplete = function(file:FileReference):Void {
  var startW = targetClip._width;
  var startH = targetClip._height;
}
  1. listener.onComplete = function(file:FileReference):Void {
  2.   var startW = targetClip._width;
  3.   var startH = targetClip._height;
  4. }


You might also be able to use the BitmapData class to get information specific to the image but I can't imagine it would be that complex

Post Information

  • Total Posts in this topic: 2 posts
  • Users browsing this forum: No registered users and 20 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.