-PLEASE HELP- Resizing To Fit Rez...but Keeping Aspect Ratio
OK...I've looked for this soultion around but I havent found it.
Basically I have a page with flash (www.madisyn.com , click on "knight" image, then click on "Learn more about Knight") , and the movie used to be at a specific size, so 800*600 users could see it without scrolling....but users at high resolutions (I'm at 1280*1024) complain of the text being too small to read, or just plain uncomfortable.
What I'm trying to do is make the mpvie resize to fit any resolution, but KEEP IT'S ASPECT RATIO...I've had problems where I'm using percentages, and differnt "scale" options, and I get stretched images, or small movies with lots of blank vertical or horizontal space. Basically I would need the movie to just "grow"...affecting both the width and height at the same time, at the same ratio, so the movie keeps the same dimensions, and doesnt grow too vertically or horizontally.....
I'm at my wit's end with it...ANybody have a clue what I could do?
Thanks, Omesh Persaud www.organicperception.com
FlashKit > Flash Help > Flash MX
Posted on: 09-10-2003, 03:52 PM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Resizing Movies To Fit Rez...but Keeping Aspect Ratio.
OK...I've looked for this soultion around but I havent found it.
Basically I have a page with flash (www.madisyn.com , click on "knight" image, then click on "Learn more about Knight") , and the movie used to be at a specific size, so 800*600 users could see it without scrolling....but users at high resolutions (I'm at 1280*1024) complain of the text being too small to read, or just plain uncomfortable.
What I'm trying to do is make the mpvie resize to fit any resolution, but KEEP IT'S ASPECT RATIO...I've had problems where I'm using percentages, and differnt "scale" options, and I get stretched images, or small movies with lots of blank vertical or horizontal space. Basically I would need the movie to just "grow"...affecting both the width and height at the same time, at the same ratio, so the movie keeps the same dimensions, and doesnt grow too vertically or horizontally.....
I'm at my wit's end with it...ANybody have a clue what I could do?
Thanks,
Omesh Persaud
www.organicperception.com
Scaling, Keeping Aspect Ratio
I have this video background, and I want its aspect ratio to be kept intact when the window is resized. Also I want the screen fiiled, if the aspect ratio would make the video smaller than the window it won't resize, it would just center.
http://pastebin.com/d2ae5a82d
I have that code, it gives you an idea of what I want.
however its buggy and flickers.
Scaling Movie - Keeping Aspect Ratio?
Probably asked a million times... I want to scale my movie in the browser while keeping the proportions. I need to put the swf. file into a HTML-file, because I want to keep the same backgroundcolour. Is it possible to just scale the horizontal axis according to the screensize while scaling the vertical axis in proportion? (Does anyone know what I'm talking about?) ;-)
Thanks!
Resizing The Aspect Ratio Of An MC
Hi
I’m having troubles with a full screen website I’m working on. Using mc_tween2.as and materials from www.laco.wz.cz I bumped into the following issue to do with resizing the aspect ratio of an MC. Curse my maths!
ActionScript Code:
//movieClip.command(“what to change”, what to change it to, speed in seconds, ease type, delay); cornImg.tween("_width", Stage.width/100*30, 1, "easeoutBack"); cornImg.tween("_height", Stage.height/100*30*cornImg.width/100*30, 1, "easeoutBack");
That line there, resizes the MC to 30% of the stage. But if the stage has been set to have a very small width for example, the MC will effectively copy that aspect ratio and give it a very distorted look.
I THINK I need the MC to resize according to ratio’s of the stage… NOT percentage.
So if the stage has resized to 4/20th it’s size, so must the MC.
You can view the problem by checking it out at www.simonsmultimedia.com (doesn’t work in firefox
Play around with your browsers dimensions to see.
Mark
Scaling Resizing , And Keep Aspect Ratio With Tween
I have built a forumla that is keeping the correct aspect ratio of a photo when the stage is resized, everything is working great.
I'm trying to do the same thing but I want to animate the photo position and proportion with tweens, but no matter how I'm trying to include the tween in the function the aspect ratio is wrong.
I have attached the .fla so you can understand what I mean, the .fla has no tween because is not working anyway....
Full Browser Resizing While Maintaining Aspect Ratio...
Hey guys - I beg you pls help with this one - Ive spent an entire day trying to figure this out reading posts/tuts/and screwing around with as - I even took out a pencil and started doing some math...; )
I'm trying to get an image to scale 100% but maintain its aspect ratio.
Hmm -
found lots examples which basically do this.....
Code:
Stage.scaleMode = "noScale";
Stage.align = "TL";
var introListener:Object = new Object();
introListener.onResize = function() {
bg_mc._x = 0;
bg_mc._y = 0;
bg_mc._width = Stage.width;
bg_mc._height = Stage.height;
}
Stage.addListener(introListener);
introListener.onResize();
ok thats all cool but the image distorts as it sizes equally to the browser's w. and h.
I found one post that had the above example and then made rederence to aspect ratio by commenting "do the math : 0 "
common man - throw a brother a bone....I took algebra 3 times in high school.
I admit it im a little right brain challenged.
ok enough of that - here are some examples of what Im talking about in a nutshell - background photo scales proportionately..
http://green.colorize.net/
http://www.finish.tv/
http://www.bogdanmebel.bg/bogdan-mebel-en.php
oK THANKS AGAIN!!
Andy
Full Browser Resizing While Maintaining Aspect Ratio...
Hey guys - I beg you pls help with this one - Ive spent an entire day trying to figure this out reading posts/tuts/and screwing around with as - I even took out a pencil and started doing some math...; ) spent most of my time on as.org - I've also watched Lee's full browser tut but that doesnt really appply as the bg just tiles.
And what I'm trying to do is get an image to scale 100% but maintain its aspect ratio.
Hmm -
found lots examples which basically do this.....
Code:
Stage.scaleMode = "noScale";
Stage.align = "TL";
var introListener:Object = new Object();
introListener.onResize = function() {
bg_mc._x = 0;
bg_mc._y = 0;
bg_mc._width = Stage.width;
bg_mc._height = Stage.height;
}
Stage.addListener(introListener);
introListener.onResize();
ok thats all cool but the image distorts as it sizes equally to the browser's w. and h.
I found one post that had the above example and then made rederence to aspect ratio by commenting "do the math : 0 "
common man - throw a brother a bone....I took algebra 3 times in high school.
I admit it im a little right brain challenged.
ok enough of that - here are some examples of what Im talking about in a nutshell - background photo scales proportionately..
http://green.colorize.net/
http://www.finish.tv/
http://www.bogdanmebel.bg/bogdan-mebel-en.php
oK THANKS AGAIN!!
Andy
Aspect Ratio
I am having problems with aspec ratio: here is the script i am using I am trying to have pictures maintain there aspec ration while conforming to the size of the window they are loading in. I can provide the FLA is you need:
// Set up the variables
/* Set the total number of images to load minus one so this will load images counting from zero to ten (eleven images in total). */
var NumberOfImages = 17;
/* Set the location of the images e.g. the path to the image like c:myFolderMyImages or http://www.MyWebSite.com/Images */
var LocationToImages = "images/";
// Set the image format i.e. gif, jpg etc…
var FileType = ".jpg";
// Set the size of the images you want to load
//here is the place where you set the hieght and width the window being //used i want to find a way to use this and keep the aspec of the pictures as well.
var MyImageWidth = 340;
var MyImageHeight = 210;
// Declare 'x' as a variable and set it's value to 0
// This will count the images as they load
var x = 0;
// Hide the loaded content
_root.MyImagesHolder._visible = false;
// Declare two arrays
// First array is for the location of the images
var MyArray = new Array();
// Second array is for whether an image has already been loaded or not
var MyArray2 = new Array();;
// Declare 'i' as a variable and set its value to 0
var i = 0;
// While the variable 'i' is less than the number of images do the follow
while (i<=NumberOfImages) {
// Add the following together: 'file location' , 'file number' and 'file type'.
// Then add it to the array as one hole string. For example:
// MyArray[0] = images/0.jpg,
// MyArray[1] = images/1.jpg,
// MyArray[2] = images/2.jpg
// etc...
MyArray[i] = LocationToImages+i+FileType;
// Increase the value of 'i' by 1
i++;
}
// Code for Next button
// Call the code below if the next button is clicked
_global.Next = function() {
// Disable the buttons until the image has loaded
_root.ButtonNext.enabled = false;
_root.ButtonPrev.enabled = false;
// Clear any message alerts
MessageDisplay = "Pictures By Alison";
// Set the variable 'x' as one greater than last time
x = x+1;
// So long as the variable 'x' isn't the same as the total number of images, then do the following:
if (x<=NumberOfImages) {
// Load the next image along from the last image loaded
loadMovie(MyArray[x], _root.MyImagesHolder);
// Check to see if the image has been loaded already or not but checking the second array current index value to see if it's been set to 1 or not
if(MyArray2[x] == 1){
// If the image has already been pre-loaded once, then there is no need to preload it again. Just load the image and skip the preload stage
_root.preloaderloader.gotoAndPlay(4);
// Otherwise if the image hasn't already been preloaded then do the following
} else {
// Set the second array current index to the value of 1 so that next time the index is checked flash will know the image has already
// been pre-loaded once
MyArray2[x] = 1;
// Tell the image preloader to play and preload the external images
_root.preloaderloader.gotoAndPlay(2);
}
// Otherwise...
} else {
/* Set the variable 'x' back to the variable 'NumberOfImages'. This resets the variable 'x value so that when the user reaches the end of the available images. The variable 'x' will not change in value and therefore will not try to load any more images from the array. */
x = NumberOfImages;
// Only enable the previous button
_root.ButtonPrev.enabled = true;
/* If the variable 'x' is the same as the variable 'NumberOfImages' then don't load the next image (as there aren't any more). Instead alert the user they have reached the end of available images. */
MessageDisplay = "No more images available";
}
};
// Code for Previous button
// Call the code below if the previous button is clicked
_global.Previous = function() {
//Disable the buttons until the image has loaded
_root.ButtonNext.enabled = false;
_root.ButtonPrev.enabled = false;
// Clear any message alerts
MessageDisplay = "";
// Set the variable 'x' as one less than last time
x = x-1;
// So long as the variable 'x' isn't equal to or less than zero then do the following:
if (x>=0) {
// Load the previous image along from the last image loaded
loadMovie(MyArray[x], _root.MyImagesHolder);
// Tell the image preloadr to play and preload the exsternal image
// As the previous image will have already been preloaded once we don't need to preload it again
// so instead skip the preloader stage and just load the image
_root.preloaderloader.gotoAndPlay(4);
// Otherwise..
} else {
/* Set the variable 'x' back to zero. This resets the variable 'x value so that when the user reaches the start of the available images. The variable 'x' will not change in value and therefore will not try to load any more images from the array. */
x = 0;
// Only enable the next button
_root.ButtonNext.enabled = true;
/* If the variable 'x' is the same as or less then zero then don't load the previous image (as there aren't any more). Instead alert the user they have reached the end of available images. */
MessageDisplay = "No more images available";
}
};
// Disable the next and previous buttons till the first image automatically loads
_root.ButtonNext.enabled = false;
_root.ButtonPrev.enabled = false;
// Stop the movie on this frame
stop();
Thanks in advance!!!
Aspect Ratio (4:3 Vs. 16:9)
Hey there;
I was wondering if there were any best practices, tricks or tactics for producing flash movies that worked well (ie. objects correctly repositioned) on 16:9 as well as 4:3 resolutions without completely rebuilding the movies for each resolution.
I imagine a lot of action script would be involved. Any tips would be appreciated.
Aspect Ratio Help
Hey everyone,
I'm creating an intro in Flash to use in Adobe Premiere. When I import it into Premiere, the aspect ration is off and everything is squished.
I think the problem lies in the fact that Premiere uses rectangular pixels and when you import the swf it uses square pixels? I could be totally off...
Anyway, is there any way to fix this? A setting that I can't find? A way to change the aspect ratio? Anything?
Thanks!
Aspect Ratio
I don't have a great understanding of how this works. Is aspect ratio something you can set in Flash? what is the default?
Flash 5.0 Aspect Ratio
Want to create a flash presentation that will use imported pictures, and text. But need to know how to do it so that it will work on a 16:9 plasma monitor. Any suggestions?
Aspect Ratio Question
I was wondering if anybody had tried doing this or knows a way to accomplish this. I want to have a web page that has a swf on it that will be at 100% of the browsers window size whenever the window is resized. That is easy, the problem I am having is keeping the aspect ratio 1:1 while resizeing the browser window. It seems like an easy thing to do but i just cant figure it out.
I know there are settings you can choose to make it borderless, exact fit and default, but they dont work the way that I am trying for. I want the swf to only show the 100%x100% 1:1 ratio no matter what size the browser window is. I would greatly appriciate the help from anyone.
Thanks
[CS3] 100% Swf - Yet Maintain Aspect Ratio?
Look for the code to do this... www.viewzi.tv
The swf is set to 100% of the browser, yet when you resize the browser window the swf is not squished - but the aspect ratio of the video remains true. Using exactFit will cause the swf to fit exactly to the browser window, but when you resize the frame, the swf gets squished.
anyone know how to do this?
Loader + Aspect Ratio?
Hi,
Im using loader to load in an image from my server, is there any way to specify a width value of the image loaded in but constrain it so that the width is always 100 but the height keeps the same aspect ratio as the original image?
Thanks
Aspect Ratio Of Window...
I have a number of buttons on my website that use javascript to open a new browser window (hich also contain a movie) The code I have used looks something like this:
on (release) {
getURL("javascriptpenNewWindow('projects/4_01.html','thewin','height=
420,width=720,toolbar=no,scrollbars=yes,resizable= yes') ");
}
This new window has no toolbar or anything but it is resizable (so it can fit on screen at lower resolutions). If you try to resize these, the flash movie's aspect ratio remains the same and the movie stays centered in the browser window.
I would like the browser window to have a constant aspect ratio as well - so you don't get any white bits next to my flash movie when you stretch it unevenly.
Is that possible? Can I control this like the other parameters from the getURL line or do I need some line in html? Sorry if this is a dumb question - I am new to html...
Thanks!
Aspect Ratio Question
Is there a way to set the aspect ratio of a flash movie to 16:9? The reason I ask is because I am cretaing a touchscreen that is being displayed on a Panasonic HD monitor with 1600:1200 resolution. The presentation is beautiful but everything gets squished. I know this is because flash has a 1:1 ratio and I need a 1.85:1 ratio. Is there anyway I can change that setting without just having to scale my images to compensate? PLease say there is! Thanks to anyone who can help. I'll keeep browsing in the meantime to see if I find anything.
Video Aspect Ratio
Anyone know of a way to automatically accommodate .flvs with different aspect ratios? Ideally the size of the player on the page would adjust automatically, but even automatic letterboxing would be better than things getting squashed or stretched. Currently I'm using the JW Player.
Resolution/Aspect Ratio Of .SWF
hi all,
i just need to know how the aspect ratio of swf be same when we play the swf on LCD,Plasma TVs. As currently the .swf changes if we check it on the TV screen.
Any help on this will be highly appriciated.
thanks and regards
nik
Changing The Aspect Ratio
I produced a flash movie in a 16:9 aspect ratio to be played back on a dvd wide screen hollogram, NTSC format. The original .fla file was converted to dvd for me. The question I have is this: if I want to change the aspect ratio for PAL how can I have all the images and text scale automatically if I change the background size? Is there a way to do this? Or, when the .fla file is converted to video format is it done at that stage?
Thanks for your help.
Aspect Ratio Constraint
So I have a video player, pretty much the one that Lee offers in his tutorials, but modified to my need. The only thing that I need now is some way to keep the aspect ratios of the movies playing. Most of the videos that are on the player I encoded to the correct dimensions, but the rest arn't sized that way.
So basically, is there a script that would force the videos to maintain their original aspect ratios?
Dynamic Resize With Aspect Ratio?
I have had a good search now but can't quite find out how to do what I need to do. A little bit of background first.
My colleagues often need to show our customers an flyer online. Sometimes they need to be able to zoom in on a text portion of the flyer. I rekoned flash would be a good idea for this. In order for it to be usable for my colleagues, I need to make something we can just dump in the same folder as the image.
Now, I have used actionscript to get he picture actually showing
//this.createEmptyMovieClip("piccyShower", 999);
//loadMovie("piccy.jpg", piccyShower);
So far so good, but the image, being larger than my stage, appears cropped.
I would like to then show the image at say height=400, width="whatever suits the aspect ratio", if you follow what I mean.
I have tried with setProperty and managed to make the image be like 20% tall etc, but that isn't going to work as the image might be 1000px tall one time, and only 600 the next time.
The point of this would be to then be able to make it zoom afterwards to its original size so the text portions would be readable. Can anyone help me with the initial resize please, and if anyone has ideas on the later stages I am open to them too of course
Aspect Ratio Remains The Same Though Resizable
I want to allow my Flash movie to expand or contract with the size of the browser but the aspect ratio to be the same. Any clues? My current HTML script is below...
Quote:
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="100%" height="100%" id="index" align="top">
<param name="allowScriptAccess" value="sameDomain" /><param name="movie" value="index.swf" /><param name="bgcolor" value="#ffffff" /><param name="SCALE" value="exactfit"><embed src="index.swf" width="100%" height="100%" align="top" bgcolor="#ffffff" name="index" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" scale="exactfit" />
</object>
Aspect Ratio For A Video Object
How can you maintain a video objects aspect ratio? The property maintainAspectRatio seems to work only with the flvplayback component.
Question About Picture Aspect Ratio
My question is in making a flash website the pictures never stay
the same size, the resolution of a monitor changes my pictures
to tall or fat looking, if not made in that resolution 1024x768.
but i have seen some websites not do this, is there a back script
in java in html or enbed in flash............
Mark
Maintain Image Aspect Ratio...
Hi, i try to charge a XML images inside a movieclip, but i need this movie clip maintain the aspect ratio. This movie clip gonna change with the size of the explorer, but when this change my image is going stretch. I used this code doesn't work but i try:
Code:
stageListener.onResize = function() {
MC._x = Math.round((Stage.width/2)-(MC._width/2));
MC._y = 153;
MC._height = Math.round(Stage.height-200);
};
Stage.addListener(stageListener);
My images have a size of W=900px by H=600px
and sorry for my bad english
Swf To Plasma Screen, Aspect Ratio?
Hi,
I'm working on a Flash animation that is going to be viewed on a plasma screen. What size should I be working at. Currently I'm working at 1600 x 1024.
- jg
Aspect Ratio .onresize And A Strange Component
Hi Folks,
I'm in a bit of a bind..
I'm tryng to use the onresize function to scale a quicktime VR like component proportionatly retaining its aspect ratio. I have had no problems doing this before and have used code the following code to achieve this on another site.
if (empty_mc._width) {
var ratio = 3/2;
if (Stage.width>Stage.height*ratio) {
empty_mc._height = Stage.width/ratio;
empty_mc._width = Stage.width;
} else {
empty_mc._width = Stage.height*ratio;
empty_mc._height = Math.round(empty_mc._width/ratio);
}
empty_mc._x=(Stage.width-empty_mc._width)/2;
empty_mc._y=(Stage.height-empty_mc._height)/2;
}
Problem is.. I have to dynamically load in this VR component which for some has wierd absolute width and height properties. So, in order to get it scale properly i targeted the xscale and yscale properties. It worked this way but I can't get the movie clip to retain its aspect ratio.
here is my code:
Stage.align = "LT";
// prevent the Flash movie from resizing when the browser window changes size.
Stage.scaleMode = "noScale";
// create a listener object
stageListener = new Object();
// add a methods for it to do certain things when the Stage is resized by our user
stageListener.onResize = function() {
stretchIt();
};
$ow=Stage.width;
$oh=Stage.height;
ratio=0.625
stretchIt = function () {
_root.empty_mc._xscale = Stage.width/_root.$ow*100;
(_root.empty_mc._yscale = Stage.height/_root.$oh*100);
};
Stage.addListener(stageListener);
stageListener.onResize();
myBtn_btn.onRelease = function(){
loadMovie("panorama.swf", empty_mc);
};
Much thanks to anyone who can help!!
a.
Resize And Load The Image As Per Aspect To Ratio
hi
i am trying to load the different size image like 331x494, 346x486, 2736x2880.....etc.... using this calculation i loaded the imge but height is looking same as look.
The loaded image should be shown like google image
http://images.google.co.in/images?hl=en&q=picnic&btnG=Search+Images&gbv=2 l
It should like this link
can any one help me to solve this issue...
~~
Sk
Attach Code
function redim(maxheight, maxwidth, clip) {
var w = parseInt(clip._width);
var h = parseInt(clip._height);
if (w>maxwidth) {
clip._height = (maxwidth/w)*h;
clip._width = maxwidth;
}
if (h>maxheight) {
clip._width = (maxheight/h)*w;
clip._height = maxheight;
}
}
loadListener.onLoadInit = function(target_mc:MovieClip):Void {
redim(100, 100, target_mc);
};
Video Aspect Ratio Encoding Problem
Hi,
I have lot’s of video material which I want to put online into a Flash web site.
I use Flash 8 video encoder which comes with Flash 8. Most of my video material is recorded in 16:9 aspect ratio but when I encode 16:9 aspect ratio video I receive back video with 4:3 aspect ratio which looks ugly and elongate.
Is there a way to force Flash 8 Video Encoder to encode in 16:9 aspect ratio ?
Thanks,
How Can I Constain The Aspect Ratio Of A Dynamic Image?
This is the site I'm working on...
http://www.bus15.com/clients/shalowitz/Flash/
and here's what I'd like to do...
You see the image being loaded into the background (which is a duplicate of the current image being displayed) is currently set to:
Code:
backgroundMC._width = Stage.width;
backgroundMC._height = Stage.height;
However, ideally, I'd like the image to fill the screen without distorting the aspect ratio of the image and center itself on the screen. Does anyone know if this is possible?
Thanks!
Color Profile And Pixel Aspect Ratio
So here I am working away again in my Flash CS/Flexbuilder (for AS project) world.
I'm "aware" of what these do, and even played around a little, but frequently saw little if any difference unless I was using photographs...
...what, in practical terms that a programmer can understand (how's that a programmer saying that to a designer) are these for, and is there any benefit to a coder:
- Color Profile
- Pixel Aspect Ratio
If you've never seen them, create a new profile in CS3, and click the "Advanced" tab.
What would be the benefit to a coder? I dunno, would tweens work better under certain conditions, is there any memory savings, are some allegedly processed more efficiently than others...how's it relate to printing...?
Preserve Aspect Ratio Scaling Bg Img In Browser
Hey Guys,
Was wondering how to go about preserving the aspect ratio of an image I'm using as the background of a flash file scaled to %100 width and height of the browser.
A good example is here: www.minus.dk
The background scales as you resize the browser but it also preserves the aspect ratio of the image so it never looks distorted.
So far my action script for scaling the background image looks like this:
ActionScript Code:
Stage.scaleMode = "noScale";
Stage.align = "TL";
stageResize = function(){
background_img._width = Stage.width;
background_img._height = Stage.height;
}
stageResize();
var stageListener:Object = new Object();
stageListener.onResize = function() {
stageResize();
};
Stage.addListener(stageListener);
This scales my image to the size of the stage but if I resize it, it starts to distort the aspect ratio. How can I get it to work more like the bg img on www.minus.dk ?
Thanks in advance for any help!
Fullscreen Flash And Load Movies, Aspect Ratio
Hi
i am putting together a site using the stage functions in flash
you can see in the demos (run layout2) that i have the elements resizing but the loaded swf is very stretched
i have the liquid layout which works fine. one of the liquid bits if a placeholder that i want to load external movies into and have them scale to fit the maximum without distorting the image
it prob easier if you check out the files
(flash8)
[MX04] Aspect Ratio Changing During Alpha Tween
I'm trying to just fade one image in then out over the top of my background image. Both images are the same size as the stage. There is no motion involved, just a change of alpha from zero to 100, then 100 to zero.
During the transitions, the top picture pops to a slightly stretched version. This is reproduceable, as I struggled with four different images in a previous project file.
[rant]I'm used to the aspect ratio of still images changing during fades in Premiere. It doesn't make sense, but I'm used to it. Now the problem has migrated to another type of software with a totally different technology. Maybe I can try a fade between two different 35mm slide projectors and the glass slides will stretch during transitions, too.[/rant]
So, why does this happen? How do I kill it?
Thanks for any replies.
AttachBitmap/aspect Ratio Not Working Until Browser Resized
Hello,
I'm working on a large bitmap background site and for some reason, I can't get the bitmap to resize (with the correct aspect ratio) upon loading. It only works after the window has been resized. When I try to call the function after the bitmap has been loaded it displays nothing until the window is resized.
This is my Actionscript:
ActionScript Code:
import flash.display.*;
// this tells Flash NOT to allow the assets to be scaled
Stage.scaleMode = "noScale";
Stage.align = "TL";
// need to set up a listener object to say when the stage is resized.
var stageListener:Object = new Object();
Stage.addListener(stageListener);
setBackground();
// called when the stage is resized
stageListener.onResize = function() {
setBackground();
}
function loadBitmapSmoothed(url:String, target:MovieClip) {
// Create a movie clip which will contain our unsmoothed bitmap
var bmc:MovieClip = target.createEmptyMovieClip("bmc",target.getNextHighestDepth());
// Create a listener which will notify us when the bitmap loaded successfully
var listener:Object = new Object();
// Track the target
listener.tmc = target;
// If the bitmap loaded successfully we redraw the movie into
// a BitmapData object and then attach that BitmapData to the target
// movie clip with the smoothing flag turned on.
listener.onLoadInit = function(mc:MovieClip) {
mc._visible = false;
var bitmap:BitmapData = new BitmapData(mc._width, mc._height, true);
this.tmc.attachBitmap(bitmap, this.tmc.getNextHighestDepth(),"auto", true);
bitmap.draw(mc);
};
// Do it, load the bitmap now
var loader:MovieClipLoader = new MovieClipLoader();
loader.addListener(listener);
loader.loadClip(url, bmc);
}
// Sample code
createEmptyMovieClip("mc1", getNextHighestDepth());
mc1.createEmptyMovieClip("mc", mc1.getNextHighestDepth());
//mc1.mc.loadMovie("flash.jpg");
loadBitmapSmoothed("flash.jpg", mc1.mc);
function setBackground() {
// determine middle
var middleX = Stage.width/2;
var middleY = Stage.height/2;
// scale background to fit width and height
mc1.mc._width = Stage.width;
mc1.mc._height = Stage.height;
// see if it grew bigger horizontally or vertically and adjust other to match
// to maintain aspect ratio
mc1.mc._xscale > mc1.mc._yscale ? mc1.mc._yscale = mc1.mc._xscale : mc1.mc._xscale = mc1.mc._yscale;
}
setBackground();
For an example of this code in usage:
http://www.kevinburkedesigns.com/bitmap/
Help would be GREATLY appreciated!
Video Player Problemo (aspect Ratio Issues)
I've got my video controls working now (no thanks to the zero replies to my last cry for help, but i'm not bitter ) , but i've run into a new perplexing issue:
(Using Flash MX Pro, Mac OSX)
I've got a movie that loads one of 3 external swf files that contain embedded video. The loader mov is set to 300 x 220, as are the video movies being loaded. But when they get loaded the video's size/aspect ratio are not the same as I told them to be. I've even imported the vid movies into the loader's library to check them and they come in as 267 x 216. Does anybody know what's going on?
Correcting Pixel Aspect Ratio With Publish Settings
Same old, I know. I'm designing and producing a Flash site using a Mac, but it will be viewed on a large touchscreen (1366x768) driven by a PC. The vectors look fine when going from the Mac 1.1 pixel aspect ratio to the Windows 1.0 display, but the photos look degraded and squashed vertically. Could I fix with the Publish settings ... such as html- publish at 100% width, 99% height? I can't test easily because my pc's have such fuzzy old displays, I can't see a thing. Flying blind. The only time I see how awful it looks on a good PC display is when I review the work to the client on the client's own PC...ouch.
[Flash 8] Image Aspect Ratio Problem On Resize
Hi, i've been trying to figure this out all morning with no luck, i'm trying to create a site that can dynamically resize elements depending on the size of the browser, or if someone drags and resizes the window displaying the page.
The problem i'm having right now though is getting a background image to resize while keeping it's aspect ratio, here is my code:
Code:
Stage.align = "TL";
Stage.scaleMode = "noScale";
//Site content
stretch_bar._width = Stage.width;
//Define the role of the listener
sizeListener = new Object();
sizeListener.onResize = function(){
//Get the new dimensions of the stage:
var stageWidth:Number = Math.round(Stage.width);
var stageHeight:Number = Math.round(Stage.height);
trace ("stage size is now " + Stage.width + " px by " + Stage.height + " px");
//This is what is giving me the trouble,
//but i don't know what i am doing wrong
var aspectratio = Stage.width/Stage.height;
photo_01._yscale = aspectratio * photo_01._xscale;
stretch_bar._width = Stage.width;
}
Stage.addListener(sizeListener);
I've used google to try find an answer and got pretty close with, however all that happens is that when the window is dragged down the photo squashes upwards and when the window is dragged up the photo stretches down past the end of the window :confused:
Does anyone know what i am doing wrong?
Embedded Video And Scaling To Stage While Maintaing Aspect Ratio
Hi folks, I have a question about the best way to achieve a video scaling deal I'm trying to do. You can see what I have so far here:
http://www.sans-concept.com/AdamBlog/
The SWF I have at the top is currently 1024x240 pixels in size, but when I'm done it'll be 100% wide and 240 pixels tall. What I want to do is have the video running in that SWF scale with the browser window to always fill that SWF horizontally. The actual video is 640x480 pixels, but I'm cropping out the top and bottom with the SWF.
When the window is resized, I'd like for the video to maintain its aspect ratio as its scaled. That is to say, the SWF will always be 240 pixels tall, but the video inside it should scale proportionally to its original 640x480 size.
Can anyone help me with the best way to do this?
Maintain Aspect Ratio In "Video Player With Playlist"
Hello,
http://www.ultrashock.com/#/asset/40...-playlist.html
i have juz got this Video Player With Playlist. As i was set it up, i did not know that this player does not maintain the aspect ratio of my flash video. my 4:3 vids are fine but not 16:9. how can i set it to be compatiable to 16:9.
Thanks alot
Resizing, But Keeping Proportions
here's the situation:
i have an MC that is in-effect imitating a Mac OS window. however, the content is all text, saved as a grapgic symbol. i want the text (contentMC) to scale with the window, but i don't want its proportions to be distorted. is there a way that i can make an object scalable and at the same time maintain its proportions?
Keeping My Flash Movie From Resizing
How to I keep my flash movie from readjusting it self in every browser. I designed it to look right at 800x600 so when it gets bigger it looks like junk. Can anyone offer me some help. Thanks.
SWF Width Resizing But Keeping Mc Fixed
Hi,
Using Flash MX 2004 & v8.0
I've been on here before, but lost all my details...
The problem I'm having is I've got a mc with a background - I need to be able to resize the compiled swf file in width only. The main mc needs to be fixed to the left side of the swf, and with the background only stretching.
What happends is this.. If I export the file as it is, and try to resize the width using HTML or js, the whole swf distorts. I've seen this done on a few swfs on the net, obviously it uses some actionscript to accomplish this task.
Any ideas would be welcome... I've looked in many resources but to no avail.
ATB
Resizing MC's But Keeping Round Rectangle Radius
I am trying to resize an sqaure MC using actionscript it has a radius on the corners, which is altered when the clip resizes, I want the radius to stay the same whatever size the clip is, any ideas??
Resizing, Motion Tweens And Keeping Lines The Same Width
Since I have the annoying habbit of writing longwinding explainations, I'll try to keep it short and simple.
See the attached files.
See the square?
I want to resize it with a tween, but only the light blue filling.
so the border (consisting of thinner and thicker lines) has to stay like it is now.
Obviously, the horizontal ones (up and down) can resize in width, and the vertical ones in height (else the filling wouldn't fit anymore obviously), but that's it. So the line thickness stays 1 or 3 pixels depending on which one).
Is this possible?
I noticed that you can resize a square with an outline without the outline resizing (no use to me, since those outlines always give a slight curve at the edges, and I don't want that. Can you convert a filled square to a line?)
Resizing .swf To 100% Of Screen While Keeping It's Content At It's Native Resolution
I've posted this question before on the design board because it deals with aesthetics but I think this may be a better forum for it.
I think the issue I'm asking about is how one might resize an .swf to 100% of a viewers screen height and width while keeping the content center screen and at it's native resolution. Below is a link to an example:
Just wondering how this might be achieved???
How do they get the BG image to go 100% of the screen height and width without affecting the resolution (clarity) of the main content section? Maybe I'm incorrect, but isn't the BG image imbedded within a .swf? When reviewing the html container documents source it showes the browser being told to display the "mainswf" at 100%.
My guess then would be that the content portion of the site is a separate swf that is loaded into the "mainswf" (only a guess though).
If this is the case, how is the resizing of the main movie not affecting the content's resolution?
Or...maybe...my assumption is incorrect...and their achieving this in an altogether different manner.
Anyone got an idea?
Thanks!!!!!
|