4340 posts Community Mod Building awesome stuff for your mobile devices!
  • Has referred 100+ members
  • Has sold $125,000+ on Envato Market
  • Has been a beta tester for an Envato feature
  • Has collected 1+ items on Envato Market
+14 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 )

1081 posts
  • Elite Author: Sold more than $75,000 on Envato Market
  • Has sold $500,000+ on Envato Market
  • Has been part of the Envato Community for over 6 years
  • Has referred 500+ members
+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.

4340 posts Community Mod Building awesome stuff for your mobile devices!
  • Has referred 100+ members
  • Has sold $125,000+ on Envato Market
  • Has been a beta tester for an Envato feature
  • Has collected 1+ items on Envato Market
+14 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!

1081 posts
  • Elite Author: Sold more than $75,000 on Envato Market
  • Has sold $500,000+ on Envato Market
  • Has been part of the Envato Community for over 6 years
  • Has referred 500+ members
+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/

4340 posts Community Mod Building awesome stuff for your mobile devices!
  • Has referred 100+ members
  • Has sold $125,000+ on Envato Market
  • Has been a beta tester for an Envato feature
  • Has collected 1+ items on Envato Market
+14 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!!!

5360 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;

4340 posts Community Mod Building awesome stuff for your mobile devices!
  • Has referred 100+ members
  • Has sold $125,000+ on Envato Market
  • Has been a beta tester for an Envato feature
  • Has collected 1+ items on Envato Market
+14 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! :)

5360 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 3 years
  • Has referred 1+ members
  • Has sold $1,000+ on Envato Market
  • Has collected 10+ items on Envato Market
+4 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 :)

by
by
by
by
by
by