Embed Text in Flex Application, Why?
I just needed to make a clients web site into a projector file, but since I rarely embed assets (opting to load them at runtime), the projector file was not loading the text.
If you have even a slight interest in this, you know that embeding graphical assets is trivial. While embeding text from an external file is still trivial, it can be a little confusing until you see how it’s done.
So enjoy the code below, it is the easy way to embed text into your flex application. (I embedded html text by the way)
import mx.core.ByteArrayAsset;
import flash.utils.ByteArray;
[Bindable]
[Embed(source=”myText.txt”, mimeType=”application/octet-stream”)]
private var _myTextClass:Class;
var daTxt:ByteArrayAsset = ByteArrayAsset(new _myTextClass());
var daTxtStr:String = daTxt.toString();
textControl.text = daTxtStr;
or you could grab the ByteArrayAsset data this way:
var daTxtStr:String = daTxt.readUTFBytes(daTxt.length);
That’s it. Pretty simple after you see it done.
loan auto 84 month 4.99loans ameriquest homeloans 24102c000 personalafter auto bankruptcy loans$1000 loanbridge about loans homeloan advance arizona cashpennsylvania loans home affordableadjustable mortgage rate loanadvance brokers loan fee
movies ladies dildos withporn and younger movie lesbianhot movie longlong movie clips sexbeast mature moviesmilf mature moviefood messy sex moviesfucking milf moviesmilf movies samplemovie mimi rogers nude
american pharmacy college accreditationcredit union 1stchoiceaccreditation liberty universitycredit adverse mortgage belfastprep courses lsat accreditedorganization accredited accupuncturistwarren accreditation wyoming of universityunion americas springfield mo credit Map
sex video alanaamatuer panties teenactriz pornoniche adult pornadult sexual clubs bi virginiaporn amateur dumper1000 porn 1 woman manoral sex amatuer Map
albq casinos mnage wisconsin 18 gamblingage ohio casinos cleveland for inamerican casinos friendly onlinemichigan treatment addiction gamblingor feathers casino 7amazon casino royalecredit gambling merchant card account Map
If you enjoyed this post, make sure you subscribe to the SDFlex RSS feed!
September 28th, 2008 at 6:30 pm
Thanks for that posting I had hard time finding something this clear that works !!!
Yan~
September 28th, 2008 at 9:02 pm
Yan,
I’m glad you found it helpful.
Kev