This works for me in LivePreview if I apply it in configUI and don't draw:
public class EditableBitmap extends UIComponent { protected var placeholder:String = "None"; protected var bitmap:Bitmap; protected var scale:Number = 1; [Inspectable(name = "Placeholder", type = String, defaultValue="None")] public function set Placeholder($value:String):void { placeholder = $value; configUI(); } public function get Placeholder():String { return placeholder; } public function EditableBitmap() {
NOTE. . When I work on FLA, where I edit the component, the bitmap is displayed only from the library inconsistently. Sometimes it works, sometimes it doesnβt. But when I export SWC and then import the component into another movie, it works every time, both in LivePreview and at runtime.
UPDATE This does not seem to work in CS6 unless the character is already embedded in the .SWC component. I wanted to see if I could fool him by inserting one image into SWC, and then replacing it with a different name in the destination file. This did not work, but it reminded me of how you can do this:
So this is a bit complicated, but you can get around this:
1) Create a dummy asset for each property in the SWC component. 2) Overriding this using a custom class in the file where you deploy the component
... all this may be more of a problem than it is worth, but which should provide a solution to the problem.
source share