4601 posts Community Mod Building awesome stuff for your mobile devices!
  • Contributed a blog post
  • Elite Author: Sold more than $75,000 on Envato Market
  • Helps us moderate the forums
  • Has sold $125,000+ on Envato Market
+15 more
Enabled Moderator says

Hey guys. I have a new file getting ready for launch, it’s fully driven from XML but I cam across a problem, wanted to add scaleX and scaleY as well as width and height control from XML , but I realized that these that these two don’t quite mix together. My question for you guys.

What should I renounce adding in the XML ? scaleX & scaleY or .width & .height control ?

I’d really appreciate the help.

( For those who need extra details, these are settings for some icons )

1082 posts
  • Elite Author: Sold more than $75,000 on Envato Market
  • Made it to the Authors' Hall of Fame
  • Had an item featured on Envato Market
  • Has been part of the Envato Community for over 6 years
+9 more
damojo says

As an XML setting I would always use width and height as those refer to pixel values that buyers can actually work with.

scaleX and scaleY always depend on the starting size of your object which might be confusing for buyers.

4601 posts Community Mod Building awesome stuff for your mobile devices!
  • Contributed a blog post
  • Elite Author: Sold more than $75,000 on Envato Market
  • Helps us moderate the forums
  • Has sold $125,000+ on Envato Market
+15 more
Enabled Moderator says
As an XML setting I would always use width and height as those refer to pixel values that buyers can actually work with. scaleX and scaleY always depend on the starting size of your object which might be confusing for buyers.

Yeah, indeed, but here is my problem, as the file is loaded form the XML , if I add the scale to 0.99 then it automatically makes the icon look like it was bitmapCached or smoothing set to true, even though these functions are not added in code, yet, If i change the icon size by width and height, the icon becomes pixelated and looses quality… this is my main concern … I have never used the smoothing=true for XML ( never worked for me :| )

Am I making myself clear or should explain more verbosely?


    function loadrssIcon(url:String):void {
        rssIcon = new Loader();
        rssIcon.load(new URLRequest(url));
        rssIcon.contentLoaderInfo.addEventListener(Event.COMPLETE, rssIconLoaded);

    }

    loadrssIcon(xml.settings.rss_icon);

    function rssIconLoaded(e:Event):void {
        rss.addChild(rssIcon);
    }

This is my icon loader. If anyone can tell me how to enable smoothing for icons loaded externally using a loader type like the one above… I would really be grateful!

1082 posts
  • Elite Author: Sold more than $75,000 on Envato Market
  • Made it to the Authors' Hall of Fame
  • Had an item featured on Envato Market
  • Has been part of the Envato Community for over 6 years
+9 more
damojo says

You will need to write the loaded image data into a bitmap and activate smoothing.

See here for an example: http://newsourcemedia.com/blog/smoothing-dynamically-loaded-images-in-as3/

4601 posts Community Mod Building awesome stuff for your mobile devices!
  • Contributed a blog post
  • Elite Author: Sold more than $75,000 on Envato Market
  • Helps us moderate the forums
  • Has sold $125,000+ on Envato Market
+15 more
Enabled Moderator says
You will need to write the loaded image data into a bitmap and activate smoothing. See here for an example: http://newsourcemedia.com/blog/smoothing-dynamically-loaded-images-in-as3/

Thank you. Your link helped a lot! Problem fixed. In case anyone else hits this wall, here is the link I learned form as an extra to the one above http://www.webdesignmo.com/blog/2008/08/28/as3-bitmap-smoothing-in-flash/

Thanks damojo!!! *


    function loadrssIcon(url:String):void {
        rssIcon = new Loader();
        rssIcon.load(new URLRequest(url));
        rssIcon.contentLoaderInfo.addEventListener(Event.COMPLETE, rssIconLoaded);

    }
    loadrssIcon(xml.settings.rss_icon);

    function rssIconLoaded(e:Event):void {
    var rssSmoothing:Bitmap = new Bitmap();
    rssSmoothing = Bitmap(rssIcon.content);
    rssSmoothing.smoothing = true;
        rss.addChild(rssIcon);
    }

Here is the code in case anyone else hits this problem.

Again, thanks a lot *damojo!!!

5411 posts The Dude Abides
  • Located in United States
  • Elite Author: Sold more than $75,000 on Envato Market
  • Has sold $125,000+ on Envato Market
  • Has been part of the Envato Community for over 5 years
+9 more
CodingJack says

Quick way:

e.target.content.smoothing = true;

or

(e.target.content is Bitmap) ? e.target.content.smoothing = true : null;

4601 posts Community Mod Building awesome stuff for your mobile devices!
  • Contributed a blog post
  • Elite Author: Sold more than $75,000 on Envato Market
  • Helps us moderate the forums
  • Has sold $125,000+ on Envato Market
+15 more
Enabled Moderator says
Quick way:

e.target.content.smoothing = true;

or

(e.target.content is Bitmap) ? e.target.content.smoothing = true : null;

Neah, because the XML loads other setting beside the icons, icons are loaded differently to allow preloading them in a predetermined order. The best solution for me in this case was the one posted by me above. But I will keep yours in mind, I came across a problem where your solution would have been AWESOME to have. So thanks mate! :)

5411 posts The Dude Abides
  • Located in United States
  • Elite Author: Sold more than $75,000 on Envato Market
  • Has sold $125,000+ on Envato Market
  • Has been part of the Envato Community for over 5 years
+9 more
CodingJack says

There’s no difference between the two. You can still addChild like this:

addChild(e.target.content);

CreativeAddiction
CreativeAddiction Recent Posts Threads Started
160 posts
  • Has been part of the Envato Community for over 4 years
  • Has referred 1+ members
  • Has sold $1,000+ on Envato Market
  • Has collected 10+ items on Envato Market
+3 more
CreativeAddiction says

private function completeHandler(e:Event):void {
    var imageToBitmap:BitmapData=e.target.content.bitmapData;
...

Another way to grab the bitmap data of a loaded image :)

Helpful Information

  • Please read our community guidelines. Self promotion and discussion of piracy is not allowed.
  • Open a support ticket if you would like specific help with your account, deposits or purchases.
  • Item Support by authors is optional and may vary. Please see the Support tab on each item page.

Most of all, enjoy your time here. Thank you for being a valued Envato community member.

Post Reply

Format your entry with some basic HTML. Read the Full Details, or here is a refresher:

<strong></strong> to make things bold
<em></em> to emphasize
<ul><li> or <ol><li> to make lists
<h3> or <h4> to make headings
<pre></pre> for code blocks
<code></code> for a few words of code
<a></a> for links
<img> to paste in an image (it'll need to be hosted somewhere else though)
<blockquote></blockquote> to quote somebody

:grin: :shocked: :cry: Complete List of Smiley Codes

by
by
by
by
by
by