![]() |
![]() |
||||||
|
|||||||
| Tags: |
![]() |
|
|||
|
Hi guys, any of you knows a way to stretch a picture in a component "Image"
without the proper scaling?, the thing is i did it before astro with certain code in php, so the user for example uploaded a picture and it got to the right size, but sometimes they had to wait to upload to the server to see the standard size preview. now with astro, nice thing you can load the image at runtime and just preview it "how is going to be" before uploading the image to the server.... this is the closest thing have gotten, but still the image cant get to a certain size, that will be Heigth : "300", width : "400", when loaded directly with image component, it just kept scaling, so certain areas of the image component ketp empty..... it doesnt matter if it distorts.... i am porting my project from php to flex... have learned many things about flex, great language, but cant get this working properly. probably is a simple thing for some of you guys, help!. here is the code is currently in.... private function image_completeHandler(event:Event):void { bmd = Bitmap(event.currentTarget.content).bitmapData; // Retrieve a temporary reference to the original BitmapData object originalBitmapData = bmd; // Set the amount by which to scale the bitmap var scaleFactor:Number = .5; // Calculate the new dimensions of the scaled bitmap var newWidth:int = originalBitmapData.width * scaleFactor; var newHeight:int = originalBitmapData.height * scaleFactor; // Create a new BitmapData object, sized to hold the scaled bitmap scaledBitmapData = new BitmapData(400, 300, bmd.transparent); // Create a transformation matrix that will scale the bitmap scaleMatrix = new Matrix( ); scaleMatrix.scale(scaleFactor, scaleFactor); //scaleMatrix.d = 1; // Draw the scaled bitmap into the new BitmapData object scaledBitmapData.draw(originalBitmapData, scaleMatrix); // Replace the original BitmapData object with the // new, scaled BitmapData object bmd = scaledBitmapData; bitmap = new Bitmap(bmd); /// IMAGE COMPONENT... imagenTransformada.source = bitmap; } |
| Sponsored Links |
|
|||
|
nice, slaingod... thx. fixed....
now 1 posibility is opened to send the filereference to the image to the server... and the user to preview like going to be save on the server.... but another possibility, would not be nice, the user for example that big image is compressed into flash(changing bitmapdata height, width) then be sent for example to php and not the "fileference" from the original file which cout be many mbs?? anyone how to get handled width,height in bitmapdata, or... is possible to take the picture on the "Image" component and get it ready for sending it to server? thx, if this is resolved, theses steps could be great for a tutorial, thx again slaingod. |
![]() |
| Thread Tools | |
| Display Modes | |
|
|
- Contact Us
-|-
Adobe Dreamweaver Forums -|-
Archive -|-
Top -|-Rules/Disclaimer-|-Help/Support-|-Advertise