Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 01-19-2010, 12:56 AM   #1
Registered User
Join Date: Jan 2010
Posts: 2
Default Smooth Image Scaling in Flash 7

Greetings ActionScript.org.

I'm a Flash newbie and I'm hoping you can get me past my final hurdle on this project: Scaling the image to the size of the movie.

I'm using the following code to load a jpg onto the stage:

ActionScript Code:
Stage.scaleMode = "showAll"; var container:MovieClip = createEmptyMovieClip("container", getNextHighestDepth()); var mcLoader:MovieClipLoader = new MovieClipLoader(); mcLoader.loadClip("Surfcat-1149741464.jpg", container); // I hoped something like this would work but Stage.height is undefined in the debugger. //container._height = Stage.height; //container._width = Stage.width;

The picture seems to expand the size of "container" beyond the stage and you only see the top-left corner. I'd like to smoothly scale it to fit the size of the stage, while maintaining the aspect ratio.

Note that while I'm developing using Flash CS3 Pro, I am targeting Flash 7/AS2 by design for two reasons:
  1. I want the movie to play, even if my visitors haven't updated their Flash Player since 2003.
  2. Flash 7 has smooth scaling built-in as long as you choose "Best" quality.
Can anyone point me in the right direction?
Attached Files
File Type: zip AS2Flash7.zip (420.3 KB, 108 views)
Knowzy is offline   Reply With Quote
Old 01-20-2010, 05:22 PM   #2
Registered User
Join Date: Jan 2010
Posts: 2

OK, I'm getting closer. I'm scaling the image to the stage (at least initially) but the smoothing isn't happening.

What does it take for force smoothing in Flash 7?

Here's what I've tried:
  • Publish Settings uses "Best" Quality
  • Set _quality to "BEST" in first frame's Actions.
  • Set movieClip.forceSmoothing to true.
  • Set movieClip._quality to "BEST", though documentation says this is unnecesary when global _quality is set.
I've read many times at ActionScript.org and in this famous blog post that Flash 7 smooths images as long as you set the quality to Best. I must be missing something. Any ideas?

Here's my latest code. It lives in the first frame's Actions:

ActionScript Code:
Stage.scaleMode = "showAll"; _quality    = "BEST"; var ImageHeight, ImageWidth; var container:MovieClip = createEmptyMovieClip("container", getNextHighestDepth()); container.forceSmoothing = true; container._quality = "BEST"; var mcLoader:MovieClipLoader = new MovieClipLoader(); mcLoader.loadClip("Christmas_In_July.jpg", container); var MCListener = new Object(); MCListener.onLoadInit = function(container:MovieClip) {     ImageWidth = container._width;     ImageHeight = container._height;     resizeFunction(); } mcLoader.addListener(MCListener); var resizeFunction = function():Void {     if (ImageWidth > ImageHeight)     {         container._height = Math.round(ImageHeight * (Stage.width / ImageWidth));         container._width = Stage.width;     }     else     {         container._width = Math.round(ImageWidth * (Stage.height / ImageHeight));         container._height = Stage.height;     } }
Knowzy is offline   Reply With Quote

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

All times are GMT. The time now is 06:49 AM.

Follow actionscriptorg on Twitter


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.