Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to apply smoothing to dynamically placed JPGs 1

Status
Not open for further replies.

carmenMiranda

Programmer
May 22, 2003
47
0
0
GB
Hi,

I have a SWF which imports JPGs at runtime, using references imported from an XML file. Consequently, the JPGs themselves are not in the library of the FLA.

Ordinarily, when a JPG is present in the library, you can select it's properties and check the box 'allow smoothing' to make scaling transitions look, well, smoother ;-)

Is it possible to apply this smoothing effect (using AS2) to the JPGs that are imported at runtime? If so, how?
 
Thanks for that, but I'm not sure how I would make that work with my existing code. Here's the line I'm currently using to import my JPG:

Code:
inner_mc.loadMovie(nodes[i].attributes.image);

((nodes.attributes.image) imports the JPG filename from the XML file)

I've tried writing this:
Code:
image1 = nodes[i].attributes.image;
inner_mc.attachBitmap(image1, 1, "auto", true);
but it doesn't work. Do you have any idea why?
 
What you need to do is to use MovieClipLoader to load the JPEG into a MovieClip, then on load create a BitmapData and draw the MovieClip, then attach the BitmapData to a MovieClip with smoothing on.

Explained in details here:

(I'd move to AS3 if I were you - this same thing is done in very little code in AS3 ;)

Kenneth Kawamoto
 
That's really helpful, thank you very much. I've been a bit slow to think about transitioning to AS3, but this is the kind of thing that makes me think it's long overdue...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top