- Has been a member for 4-5 years
- Repeatedly Helped protect Envato Marketplaces against copyright violations
- Sold between 50 000 and 100 000 dollars
- Microlancer Beta Tester
- Community Moderator
- Interviewed on the Envato Notes blog
- Author was Featured
- Bought between 1 and 9 items
- Referred between 50 and 99 users
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 )
- Sold between 250 000 and 1 000 000 dollars
- Has been a member for 5-6 years
- Author was Featured
- Item was Featured
- Author had a File in an Envato Bundle
- Author had a Free File of the Month
- Interviewed on the Envato Notes blog
- Referred between 200 and 499 users
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.
- Has been a member for 4-5 years
- Repeatedly Helped protect Envato Marketplaces against copyright violations
- Sold between 50 000 and 100 000 dollars
- Microlancer Beta Tester
- Community Moderator
- Interviewed on the Envato Notes blog
- Author was Featured
- Bought between 1 and 9 items
- Referred between 50 and 99 users
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!
- Sold between 250 000 and 1 000 000 dollars
- Has been a member for 5-6 years
- Author was Featured
- Item was Featured
- Author had a File in an Envato Bundle
- Author had a Free File of the Month
- Interviewed on the Envato Notes blog
- Referred between 200 and 499 users
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/
- Has been a member for 4-5 years
- Repeatedly Helped protect Envato Marketplaces against copyright violations
- Sold between 50 000 and 100 000 dollars
- Microlancer Beta Tester
- Community Moderator
- Interviewed on the Envato Notes blog
- Author was Featured
- Bought between 1 and 9 items
- Referred between 50 and 99 users
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!!!
- United States
- Has been a member for 4-5 years
- Exclusive Author
- Author was Featured
- Sold between 50 000 and 100 000 dollars
- Item was Featured
- Contributed a Tutorial to a Tuts+ Site
- Author had a Free File of the Month
Quick way:
e.target.content.smoothing = true;
or
(e.target.content is Bitmap) ? e.target.content.smoothing = true : null;
- Has been a member for 4-5 years
- Repeatedly Helped protect Envato Marketplaces against copyright violations
- Sold between 50 000 and 100 000 dollars
- Microlancer Beta Tester
- Community Moderator
- Interviewed on the Envato Notes blog
- Author was Featured
- Bought between 1 and 9 items
- Referred between 50 and 99 users
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! 
- United States
- Has been a member for 4-5 years
- Exclusive Author
- Author was Featured
- Sold between 50 000 and 100 000 dollars
- Item was Featured
- Contributed a Tutorial to a Tuts+ Site
- Author had a Free File of the Month
There’s no difference between the two. You can still addChild like this:
addChild(e.target.content);
private function completeHandler(e:Event):void {
var imageToBitmap:BitmapData=e.target.content.bitmapData;
...
Another way to grab the bitmap data of a loaded image 
