4146 posts Community Mod Building awesome stuff for your mobile devices!
  • Community Moderator
  • Elite Author
  • Sold between 100 000 and 250 000 dollars
  • Interviewed on the Envato Notes blog
  • Author had a Free File of the Month
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • Contributed a Tutorial to a Tuts+ Site
  • Won a Competition
+9 more
Enabled Volunteer 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
  • Sold between 250 000 and 1 000 000 dollars
  • Elite Author
  • Has been a member for 6-7 years
  • Author had a File in an Envato Bundle
  • Author had a Free File of the Month
  • Interviewed on the Envato Notes blog
  • Referred between 500 and 999 users
+4 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.

4146 posts Community Mod Building awesome stuff for your mobile devices!
  • Community Moderator
  • Elite Author
  • Sold between 100 000 and 250 000 dollars
  • Interviewed on the Envato Notes blog
  • Author had a Free File of the Month
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • Contributed a Tutorial to a Tuts+ Site
  • Won a Competition
+9 more
Enabled Volunteer 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
  • Sold between 250 000 and 1 000 000 dollars
  • Elite Author
  • Has been a member for 6-7 years
  • Author had a File in an Envato Bundle
  • Author had a Free File of the Month
  • Interviewed on the Envato Notes blog
  • Referred between 500 and 999 users
+4 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/

4146 posts Community Mod Building awesome stuff for your mobile devices!
  • Community Moderator
  • Elite Author
  • Sold between 100 000 and 250 000 dollars
  • Interviewed on the Envato Notes blog
  • Author had a Free File of the Month
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • Contributed a Tutorial to a Tuts+ Site
  • Won a Competition
+9 more
Enabled Volunteer 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!!!

5311 posts The Dude Abides
  • United States
  • Exclusive Author
  • Has been a member for 5-6 years
  • Elite Author
  • Bought between 100 and 499 items
  • Referred between 100 and 199 users
  • Author had a Free File of the Month
+5 more
CodingJack says

Quick way:

e.target.content.smoothing = true;

or

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

4146 posts Community Mod Building awesome stuff for your mobile devices!
  • Community Moderator
  • Elite Author
  • Sold between 100 000 and 250 000 dollars
  • Interviewed on the Envato Notes blog
  • Author had a Free File of the Month
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • Contributed a Tutorial to a Tuts+ Site
  • Won a Competition
+9 more
Enabled Volunteer 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! :)

5311 posts The Dude Abides
  • United States
  • Exclusive Author
  • Has been a member for 5-6 years
  • Elite Author
  • Bought between 100 and 499 items
  • Referred between 100 and 199 users
  • Author had a Free File of the Month
+5 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
  • Author had a Free File of the Month
  • Bought between 10 and 49 items
  • Europe
  • Exclusive Author
  • Has been a member for 3-4 years
  • Referred between 1 and 9 users
  • Sold between 1 000 and 5 000 dollars
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