ActionScript 1/2 :: Proportional Resize Of An Image
Jun 18, 2009
I'm trying to do a proportional resize of an image. I know the image's original dimensions (which vary from image to image) and then I know its intended height in pixels. How do I scale it down to fit the new height whilst keeping it in proportion? Is there a simple equation to do this?
Iit works but it's just not perfect. Ihaven't played with flash since MX, things have changed a bit. Here is the online sample: [URL]. If you want the source it here: [URL]. So I would like to learn how to create an if / else function to control the height of a MC. i.e. This externalMC I used is 900 X 500, so divide 900/500 = 1.8:1 (or .5556:1) this gives you your relative ratio. Then just multiple the width of 75% of stageWidth by .5556 to get the proportional width, the problem is once the browser windows height is resized to <= 500. it stops.
I have been following the instructions posted here on how to achieve proportional image scaling: http:[url].....I want to have one image background for one frame, and then another image background on another frame... so when the viewer goes to different parts of the site the scalable background image changes.I copy and pasted the AS3 code into the actions section for the frame:
//set stage for FBF //set stage for FBF stage.align = "TL";[code].....
It gave me a duplicate function error.So I changed all the variables 'pic' to something else... for example,'pic1'.Still didn't work. Then I changed 'sizeListener' to 'sizeListener1', still didn't work.Then I changed'scaleProportional' to'scaleProportional1' and it kind of worked, but keeps giving me the error that 'scaleProportional1' but still keeps giving me errors.how I can implement multiple instances of this scalable background script on multiple pictures without conflicts?
I have the following code from FW to scale my background image while keeping proportion, however how do I change/fade into other pictures using Pic as my MC?
Code: //set stage for FBF //set stage for FBF stage.align = "TL";
I know but basically I want to place some images on the stage and I want every image, whether big or small, portrait or landscape, to be scaled to about a quarter of the stage size.
I have tried coding this myself and even tried many suggestions found on the web, but they all seem to do the same thing. The code either sizes every image to be equal in width and varying height, or scale every image to be equal in height with varying width.
Say you have some images all the same size, but some in landscape orientation and some in portrait orientation. Most of the code I found for "proportional scaling" would scale the landscape images okay, but make the portrait images the same height as the others, so they looked alot smaller. Or the reverse was true.
This makes all the images fit on the stage all right, but they all have the same width. reversing the equality amkes all teh heights the same.
If two images did not have the same width before they are scaled down, they should not have the smae width afterwards in my opinion.
Sometimes I get some code that seems to work, then I change the stage size to check it and all the images did not scale to 1/4 of the stage new size when the FLA was run.
I am working on image and i like to scale or resize the image by dragging and resize option.same working as "free transform tool" in flash (design part); i need same functionality in application.
Some images I load dynamically are too big so I would like to scale them to fit the stage.
[Code]...
this returns 0. Why does it return 0 when the image loaded is obviously much larger then 0 pixels. How do I change the width and height of imgCont to a specified dimension.
i am building an editor which allows you to resize images and to do this (once an image is selected) I add a visible border to the image that allows you to resize the image. so i want to have a function something like,
[Code]....
and i have to call this redrawborder function inside the MOUSE_MOVE listener that controls the resizing (so that i am constantly removing and redrawing the border). constantly removing and redrawing the frame seems very inefficient. is there some property or better why to do this? i want to have, displayobj.scaleChildren = false or something like that
I have a SWF that I would like to use in an XHTML 1.0 Strict document.My need is that the flash must:- Be 100% width- Grow / shrink proportionally in height (depending on width)- The flash may not be cropped or distorted- I must be able to to put a div just before the flash- I must be able to place a div right after the flash. The flash should behave just as if you pasted below image in an HTML file:[code].....
I would like to create a proportional grid. Basicly rects with same width and dotted lines as borders (no fill): It should be on full stage width and reacting on resizing (single grid rects should stay in size) only becomming less or more grids (stage width resizing smaller or larger).Some Example Sites that use such grids [URL]
I'm currently using the Tween-class to tween my movieclips (just the basics as x-position, etc.). But I'm struggling to tween scaleX and scaleY as the tween does not seem to take care of the centerpoint of the movieclip. I want the movieclip to scale proportional and not just from left to right.
I have a Movieclip containing five images in a row. I have seven images inside a mc next to eachother like a T (Five across and three down) with one image being the center image. The images are under a mask an then the images tween on the X and Y but obviously only the masked part of the image is visible. The mask is 1280x649 and I was wondering how to proportionally scale only the masked area to full screen. I have the following code which works perfectly on a single image inside a mc but how do I do now?
I am using the following code to fill the browser window with an image and scale it up or down....works great. I would like to proportionately scale a mc but not have it initially fill the screen. It would start centered in the window at a initial size but then scale up as the browser window opens but not scale back down below it's original starting size.
this is the code for the full screen:
port1Height = new Object (); port1Height = port1._height / port1._width; port1Width = new Object (); port1Width = port1._width / port1._height;
how to proportionally scale multiple movieClips relative to the stage size.
I understand movieclip placement relative to the stage, and I have been using a code to scale MovieClips as a fullscreen background (also proportionally)
But
I can not figure out for the life of me how to scale other movieclips in relation to the stage size.
for example I have a background_mc that proportionally scales with the stage to fill without distortion.
HOW do I then place another MC say center aligned (I know how to do that) that will scale with the background without distortion?
Ideally I would like to place several MC's on my stage all scaling in proportion with the stage yet independently.
I have not been able to find any documentation on this. lots of tutorials on backgrounds and color fills and the like but nothing on proportional scaling of independent mc's
this is the code I use for my background_mc (can it be modified or should it be thrown out the window to achieve independent scaling?)
I'm creating a simple liquid flash site layout with one MC that does not scale and remains at a constant position, and one mc that should stretch to fit either the height or width (whichever's larger) of the stage, but scale proportionally. [code]...
I need some assistance on how to proportionally scale multiple movieClips relative to the stage size. I understand movieclip placement relative to the stage, and I have been using a code to scale MovieClips as a fullscreen background (also proportionally) But I can not figure out for the life of me how to scale other movieclips in relation to the stage size. for example I have a background_mc that proportionally scales with the stage to fill without distortion.
HOW do I then place another MC say center aligned (I know how to do that) that will scale with the background without distortion? Ideally I would like to place several MC's on my stage all scaling in proportion with the stage yet independently. I have not been able to find any documentation on this. lots of tutorials on backgrounds and color fills and the like but nothing on proportional scaling of independent mc's this is the code I use for my background_mc (can it be modified or should it be thrown out the window to achieve independent scaling?)
i am looking for class or something to proportional outside scaling of stage and all included objects (internal or external).I know SWFfit and LiquidStage. I have got many problems with integrating SFWfit to my code (resizing is not affected to included objects). LiquidStage seems to be ok but it`s not freeware . I am looking for free possibilities to do it.I am trying to connect that with GAIA framework.
what i m trying to do is load a image form xml and resize it to fixed height and then to centre the image on stage...however the following code is not resizing the image and neither is it centering the image...i used trace commands to check its width but i get the output as undefined also on load the images r coming rotated 90 degree.
here's my code
Code: var slidexml:XML = new XML(); slidexml.ignoreWhite = true; var currentIndex:Number = 0;
i had a xml wich is dynamically genrate the values, and i use those value to show as a image in flash as2.now the values are n numbers, if it is beyound the screen i want to resize the whole image in to best fit on my screen.
i am trying to build a resize with stage image gallery. It is working except for when you first open the swf the image has it's original size, and it only adjusts to the stage when the stage resizes.s the script:
I'm not a coder, but I recently had someone build me a Flash site ( I think using AS2). Part of the site includes scaling up a background image to the browser size, but I'm seeing terrible artifacts when this is done.
Take a look at the home page of this link to see what I mean[url]...
I was wondering if someone could tell me if it is at all possible to scale up an image like this in Flash WITHOUT the resulting artifacts?
I'm trying to create a touch application through gestureworks, specifically by adapting this tutorial - [URL] I'm trying to scale an image down when the app loads with no luck.
I know in php there is a tag to resize a image simply: $width = 120; $height = 80; if ($width && ($size[0] < $size[1])) { $width = ($height / $size[1]) * $size[0]; } else { $height = ($width / $size[0]) * $size[1]; } However, how to do this in FLASH?
I have a constant doubt. I never know why the resize image always look ugly. Today I found an example that don't look ugly and only gets better when resize. How they do that?
Can any one know a function that is doing resize and it is doing it right, because I have made a function but it I make my image small like 70x50 from 950x500 it is distorting it.