Create a BitmapData and set that as the bitmapData of a Bitmap.
Thank you for the help. This next part of it may be for another post. If not here goes.
I have the following new code see below.
I am not sure how to ask properly as i dont know the lingo. For example pourposes and to help me get a better understanding.
My image in this code is 50x50. If i wanted to try it out using my RGB data, i am going to assume that i would have to put that data into an array.
How would i take this array variable and tell img to use it ?
private function handleCreationComplete():void
var loader:Loader = new Loader();
loader.load( new URLRequest('http://192.168.0.15/image.gif' ) );
private function handleLoadComplete( evt:Event ):void
var bmp:Bitmap = ( evt.target as LoaderInfo ).content as Bitmap;
img.source = bmp;
<s:Image id="img" x="37" y="34" width="50" height="50"/>
1 person found this helpful
I’m not quite sure I understand this last question as it loads a .gif and I thought the issue is that you want to load a .bmp file.
If that’s true, you have some choices: You can load the entire bmp file as a Base64 encoded entity, and decode it in the app, parse the pixels out of the BMP file format, or you can pull the RGB values out of the BMP file on the server and send a text blob of RGB encoded data.
Let’s say you choose the latter, and the data is for a 2x2 icon and you send it in the order of (0,0), (1, 0), (0, 1), (1,1) and the text looks like: “0xFF0000,0x00FF00,0x0000FF,0xFF00FF”
In the app, you would load that with URLLoader and not Loader and do something like:
Var pixels:Array = urlLoader.data.split(“,”);
Var pixelba:ByteArray = new ByteArray();
For each (var p:String in pixels)
var px:int = int(p);
Pixelba.posiiton = 0;
Var bm:Bitmap = new Bitmap();
Var bmd:BitmapData = new BitmapData(2, 2);
Bm.bitmapdata = bmd;
I got it working now, Thank you very much for your time.
Ah yes, forgot an argument. Should be something like:
bmd.setPixels(new Rectangle(0,0,2,2), ba);
Just curious, the "ba" is what threw me.
Ah, sorry, should have been pixelba