You can create a UIComponent instead of a UIObject and add a movie clip to the UIComponent. I always used UIComponent instead of UIObject, and my sprite always displays correctly :) mxml and the code below:
<mx:UIComponent> <mx:Yoursprite></mx:Yoursprite> </mx:UIComponent>
or encoded in actionscript:
private function createSpriteInFlex():void { var _uiComponent:UIComponent = new UIComponent(); addElement(_uiComponent); var _sprite:YourSprite = new YourSprite(); _uiComponent.addChild(_sprite); }
EDIT
You can just add the mxml line like this.
<com:myUIComponent width="100%" height="100%"></com:myUIComponent>
So, myUIComponent is actually a class that you can program yourself. I will demonstrate how you can add a sprite or movie clip below:
package com.myUIComponent { public class myUIComponent extends UIComponent { public function myUIComponent() { super(); addEventListener(Event.ADDED_TO_STAGE, init); } private function init(e:Event):void { removeEventListener(Event.ADDED_TO_STAGE, init);
source share