Specifications
109ADOBE FLEX 3
Building and Deploying Adobe Flex 3 Applications
<mx:DataGrid id="myGrid" width="350" height="200" dataProvider="{initDG}"
editable="true">
<mx:columns>
<mx:Array>
<mx:DataGridColumn dataField="Album" />
<mx:DataGridColumn dataField="Price" />
</mx:Array>
</mx:columns>
</mx:DataGrid>
<mx:Button id="b1" label="Add New Item" click="addNewItem()"/>
</mx:Application>
Another use of the callLater() method is to create a recursive method. Because the function is called only after
the next screen refresh (or frame), the
callLater() method can be used to create animations or scroll text with
methods that reference themselves.
The following example scrolls ticker symbols across the screen and lets users adjust the speed with an HSlider
control:
<?xml version="1.0"?>
<!-- layoutperformance/CallLaterTicker.mxml -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Script><![CDATA[
[Bindable]
public var text:String = "SLAR:95.5....TIBA:42....RTF:34.15....AST:23.42";
[Bindable]
public var speed:Number = 5;
public function initTicker():void {
theText.move( this.width+10, 0 ); // Start the text on the right side.
callLater(moveText);
}
public function moveText():void {
var xpos:Number = theText.x;
if( xpos-speed+theText.width < 0 ) {
xpos = this.width+10; // Start the text on the right side.
}
xpos -= speed;
theText.move(xpos,0);
callLater(moveText);
}
public function changeSpeed():void {
speed = speedSelector.value;










