I have been into a research these past hours in figuring out how to add a UILoader inside a UILoader and save all the contents of a UILoader. I have two instance of UILoader (loader_inner and loader_outer) and they are both placed manually using the UILoader component. The code goes something like this:
loader_inner.load(new URLRequest("background_1.jpg"));
loader_outer.load(new URLRequest("rabbit.jpg"));
loader_outer.addChild(loader_inner);
var bitmapData:BitmapData = new BitmapData(loader_outer.width,loader_outer.height);
bitmapData.draw(loader_outer);
var jpgencoder:JPGEncoder = new JPGEncoder(100);
var mybyte:ByteArray = jpgencoder.encode(bitmapData);
var myfile:FileReference = new FileReference();
myfile.save(mybyte,"test.jpg");
The problem is during save, I can only see the a white image in file but not the two contents. I am expecting a background with a rabbit in the image file that is placed exactly on the two components drawn manually in the work space.