Friday, November 21, 2008

Easy way to pull text file into Flex 3

Super easy!
Just call a service with GET and specify the resultFormat as text.





Then, in your script tag make a bindable variable and assign the value of the service call to the variable



import mx.rpc.events.ResultEvent;
import mx.rpc.events.FaultEvent;

[Bindable]
public var myTextVariable:String;

public function txtHandler(event:ResultEvent):void
{
myTextVariable = myTextService.lastResult.toString();
}
]]>



Then bind your variable to your text field





Finally, don't forget to call your service from your application tag.

creationComplete="myTextService.send()"

No comments: