Just curious, is it actually more efficient to use AS instead of MXML (or
vice versa) when deriving new components? I'm talking about where it's
just as easy to code it either way. I'm just wondering about how the
guts of the compiler work.
For example, take these two:
package nes {
import mx.controls.Label;
import mx.controls.dataGridClasses.DataGridListData;
import flash.display.Graphics;
import mx.controls.DataGrid;
public class DetailBgColorRenderer
extends Label {
override protected function
updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void {
super.updateDisplayList(unscaledWidth, unscaledHeight);
var g:Graphics =
graphics;
if (data != null)
{
if
(data.backgroundColor != 0) {
var grid:DataGrid = DataGrid(DataGridListData(listData).owner);
g.beginFill(data.backgroundColor);
g.drawRect(0, 0, unscaledWidth, unscaledHeight);
g.endFill();
}
else
g.clear();
}
}
}
}
<?xml version="1.0"
encoding="utf-8"?>
<mx:Label xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Script>
<![CDATA[
override protected function
updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void {
super.updateDisplayList(unscaledWidth, unscaledHeight);
var g:Graphics =
graphics;
if (data != null)
{
if
(data.backgroundColor != 0)
{
var
grid:DataGrid = DataGrid(DataGridListData(listData).owner);
g.beginFill(data.backgroundColor);
g.drawRect(0, 0, unscaledWidth,
unscaledHeight);
g.endFill();
}
else
g.clear();
}
}
]]>
</mx:Script>
</mx:Label>
--
Jason