3 Replies Latest reply on Jun 7, 2011 10:31 PM by Flex harUI

    How to simply append a sprite into a Spark TextArea?

    BryBam Level 1


      How would I go about appending (not just changing the entire text area to this img, actually appending at the end of the current text) a simple 25x25 image sprite into a Spark TextArea  in a flex project? using actionscript?(not mxml so it can be added during run time) and It has to be a Spark TextArea because this is a Flex Mobile Project


      I've read html text is the way to go about it. But my real confusion lies with first it being a Sprite, so i dont have a url to link to. It's an actual sprite var (it would be a file sent over the network in bytes, and saved in a sprite object.)


      and then the second part where im lost is actually APPENDING the htmlText to the Spark TextArea inline, so it doesnt replace any of the text already in the text area, and will be scrollable in the text area.


      also, remember im trying to append this to a SPARK TEXT AREA component. I know i could just make a text field instance and thats it, but i cant find any information about appending this to a text area



      EDIT AGAIN: SInce there was some confusion about the sprite im trying to append, this is how the image is being transmitted,

      it's starting out as just a standard cameraphone image, then..



      var fs:FileStream = new FileStream();

      fs.open(new File(imageURL), FileMode.READ);

      var bytes:ByteArray = new ByteArray();



      if (bytes == null)


          trace("Image bytes is null!");





          var message:Object = new Object();

          message.type = "pic";

          message.bytes = bytes;


          trace("Picture sent!");


      Then i'm reciving it like this

      var loaderContext:LoaderContext = new LoaderContext();

      loaderContext.allowCodeImport = false;

      var loader:Loader = new Loader();

      loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onPicLoaded,false,0,true);

      loader.loadBytes(message.bytes, loaderContext);

      // add a new sprite to hold image

      imageSprite = new Sprite();




      So then finally I have the image in imageSprite... and that brings us to my main problem appending this image in a SPARK TEXT AERA.


      I'm looking for an end result that will have the look of a picture message sent on an android or iphone.