--- In flexcoders@yahoogroups.com, "Alex Harui" <[EMAIL PROTECTED]> wrote: > > Like I said, I'm trying to minimize my time per message and generally > give short answers and leave out detail. Sounds like you're on your way > and that's great. > > > > Normally, though I don't override data getter/setters in my renderers. > I map the data to a type in commitProperties. But there are exceptions > to every rule... Nevertheless, I am concerned you haven't fully > absorbed the "recipe" and maybe looking at your code will shed some > light on it for you and others as there are things you can't do in the > setter override that you should only do in commitProperties or later and > thus your current recipe may not be cloneable on your next renderer.
<mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml" width="100" height="120" horizontalAlign="center" verticalAlign="middle" horizontalScrollPolicy="off" verticalScrollPolicy="off" borderStyle="solid" > <mx:Script> <![CDATA[ import vo.MediaElement; [Bindable] private var _img:String; [Bindable] private var _swf:String; [Bindable] private var _caption:String; [Bindable] private var _data:Object; [Bindable] private var _mo:MediaElement; private var swfContent:MovieClip; private function init():void{ //movie.addEventListener(Event.INIT, swfLoadHandler); } private function swfLoadHandler(e:Event):void{ swfContent = e.target.content as MovieClip; swfContent.stop(); } override public function get data():Object{ return _data; } override public function set data(_me:Object):void{ _data = _me; this.mediaObject = _me as MediaElement; trace('media element set'); invalidateProperties(); } public function set mediaObject(me:MediaElement):void{ if (me.imgSrc != ''){ this.imgSrc = me.imgSrc; } if (me.swfSrc != ''){ this.swfSrc = me.swfSrc; } this.caption = me.caption; _mo = me; //invalidateProperties(); } public function get mediaObject():MediaElement{ return _mo; } public function set imgSrc(img:String):void{ _swf = ''; _img = img; this.currentState=""; } public function get imgSrc():String{ return _img; } public function set swfSrc(swf:String):void{ _img = ''; _swf = swf; this.currentState="isSwf"; } public function get swfSrc():String{ return _swf; } public function set caption(cstr:String):void{ _caption = cstr; } public function get caption():String{ return _caption; } ]]> </mx:Script> <mx:VBox id="viewHolder" horizontalAlign="center" verticalAlign="middle" height="100%" width="100%"> <mx:Image id="thumbImage" maintainAspectRatio="true" source="{'images/'+_img}" scaleContent="true" height="95%" width="95%"/> </mx:VBox> <mx:Label id="theCaption" width="100%" text="{_caption}" textAlign="center"/> <mx:states> <mx:State name="isSwf" enterState="init()"> <mx:AddChild relativeTo="{viewHolder}"> <mx:SWFLoader id="movie" source="{'movies/'+_swf}" maintainAspectRatio="true" width="95%" height="95%" scaleContent="true" /> </mx:AddChild> <mx:RemoveChild target="{thumbImage}" /> </mx:State> </mx:states> </mx:VBox>