Starting from a totally empty MXML application:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
layout="absolute" >
</mx:Application>
What is the script that will:
- create a bitmap (should this be a
BitmapData
object?) - programatically populate it with data (e.g. draw a circle) (is there any more efficient way to do this than repeatedly calling
BitmapData.SetPixel
?) - render it within the application (e.g. centered in the middle) (how DO I get a bitmap onto the screen? Online Flash samples show calling
myBitmap=new Bitmap(myBitmapData)
and thenmyBitmap.AddChild
, but this throws an error in Flex).
??
NOTE: The goal is not just to get a circle on the screen, it's to populate a Bitmap (or BitmapData? Or ???) object using SetPixel (or ???) and then get its contents onto the screen, as one would need to do in an image processing or visual effects application.
Best Answer
You have a couple of options. The first is to examine the Degrafa framework which has some really incredible drawing tools, otherwise you need to add a script block and use the AS3 drawing api in a function (in this case probably called on creationComplete:
This won't center the circle, but you can figure that bit out.
you can use this function to actually get the bitmap out of the above UIComponent:
from here.