Note that there are some explanatory texts on larger screens.

plurals
  1. POAS3: How do I definitively smooth a bitmap image loaded from an outside server
    text
    copied!<p>This issue has been following me around for almost a year now, and I want to kill it, for my sake and for the sake of all.</p> <p>I'm working on some banner ads that need to load in images from a client's site for display. When I tried to do this using AS2, I found out that AS2 doesn't let you do that. It's a bug in the language. There are workarounds for images on the local server, but images loaded from are not allowed to share their BitmapData, so those workarounds don't work. I ended up capitulating after about two months of banging my head against the desk and cursing Macromedia.</p> <p>Now we are talking about moving to AS3 (finally) and I'm really excited. Or, I was really excited until I started doing some tests for image quality and found that there is very little change in image quality happening here. It's a repeat of my trials with AS2: everything loads perfectly in the IDE, I get all excited, I move the swfs over to the test server to run them online, and POOF - jaggies. Jaggies everywhere.</p> <p>I've read a number of solutions online, none of which work. They include:</p> <ul> <li><p>Setting target.content.smoothing to "true". Works great in the IDE. All improvements disappear in the browser.</p></li> <li><p>Setting target.scaleX = target.scaleY to 1.01. It just breaks the swf.</p></li> <li><p>Adding "new LoaderContext(true)" to my parameters for the load command. Does nothing.</p></li> <li><p>Setting target.content.pixelSnapping to "always". Looks perfect in the IDE, not in the browser.</p></li> <li><p>Setting a crossdomain.xml file. The images are showing up - they're being loaded, even if jaggedly, so there must be a functioning crossdomain file on the client's server, right?</p></li> </ul> <p>So now I'm just stuck, and brokenhearted. Could anyone offer insight on my code, and why it might not be rendering as beautifully as it should be? Here is the client-safe version of the quick demo I am making (only the image URL has been deleted, everything else is as it is now):</p> <pre><code>import flash.events.Event; function completeHandler(e:Event) { e.target.content.pixelSnapping = "always"; e.target.content.smoothing = true; } var imgurl:String = "CLIENT'S IMAGE URL HERE"; var imageLoader01:Loader = new Loader(); var image01:URLRequest = new URLRequest(imgurl); imageLoader01.load(image01); imageLoader01.contentLoaderInfo.addEventListener(Event.COMPLETE,completeHandler); addChild(imageLoader01); imageLoader01.x = 2; imageLoader01.y = 0; imageLoader01.scaleX = imageLoader01.scaleY = .6; var imageLoader02:Loader = new Loader(); var image02:URLRequest = new URLRequest(imgurl); imageLoader02.load(image02); imageLoader02.contentLoaderInfo.addEventListener(Event.COMPLETE,completeHandler); addChild(imageLoader02); imageLoader02.x = 100; imageLoader02.y = 80; imageLoader02.scaleX = imageLoader02.scaleY = .308; var imageLoader03:Loader = new Loader(); var image03:URLRequest = new URLRequest(imgurl); imageLoader03.load(image03); imageLoader03.contentLoaderInfo.addEventListener(Event.COMPLETE,completeHandler); addChild(imageLoader03); imageLoader03.x = 200; imageLoader03.y = 180; imageLoader03.scaleX = imageLoader03.scaleY = .152; var bannerLegend:legend = new legend(); addChild(bannerLegend); </code></pre> <p>Thank you very much in advance. Any help will be sorely appreciated.</p> <p>Update: Here is the HTML embed code:</p> <pre><code>&lt;div id="swf_mr_sc_wt_si"&gt;&lt;/div&gt; &lt;script type="text/javascript"&gt; &lt;!-- var swfurl = "http://DOMAIN_WITHELD_SORRY/static/AS3.swf?m=DEFAULT&amp;t=" + (new Date().getTime()); swfobject.embedSWF(swfurl, "swf_mr_sc_wt_si", 300, 250, "8.0.0", ""); // --&gt; &lt;/script&gt; &lt;p&gt; </code></pre> <p>Hope this helps.</p> <p>Further Update: We are not listed in the crossdomain.xml file. But we can still load the jagged images. And those images, when loaded into the same swf run in the IDE, are smooth. I think I'm missing understanding of some kind of apocryphal knowledge here, because everything I read points to me being able to do this. This is VERY confusing.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload