09.23.08
9-slice scaling
Here is a pretty good write up on using 9-slice scaling in Flex to make sure your resources scale properly when you are skinning controls, it’s pretty easy concept, just hard to find in the flex documentation.
Life and Coding
Here is a pretty good write up on using 9-slice scaling in Flex to make sure your resources scale properly when you are skinning controls, it’s pretty easy concept, just hard to find in the flex documentation.
So my client wanted a list that had no layout information, or a List where you could only see the items in the list, no selection colours, no borders, no background, etc… I spent a lot of time racking my brain trying to figure out the best way to do this. Finally out of desperation I looked at the api and a few related blog posts and the answer was simple. Flex provides support for this in the base list class, so just extend the List class and tell it to not draw anything. How simple is that!
here is the code to do it:
package
{
import mx.controls.List;
import mx.controls.listClasses.IListItemRenderer;
public class TransparentList extends List
{
override protected function createChildren():void
{
super.createChildren();
setStyle( “backgroundAlpha”, “0″ );
setStyle( “borderStyle”, “none” );
}
override protected function drawItem( item:IListItemRenderer,
selected:Boolean=false,
highlighted:Boolean=false,
caret:Boolean=false,
transition:Boolean=false):void
{
super.drawItem(item, false, false, caret, transition);
}
}
}
The draw item function allows you to pass a boolean for selected and highlight parameters. very simple and easy fix to what looks at first glance to be a difficult problem. You would think as an old hand at extending the default flash library this would have been the first solution I would have looked at, must be getting lazy in my old age…
Wow it’s been a long time since I posted last. Anyway I found this very indepth article on creating tools to assist in debugging memory usage problems in c++. I’ve always been interested in the behind the scene’s working of memory analysers and this is a great read.
Monitoring Memory Usage - Gamasutra
Now if my other projects ever slow down I might just get a chance to play with some of these things.