--- In [email protected], "Alex Harui" <[EMAIL PROTECTED]> wrote: > > This renderer is based on VBox which is a container and is a bit > "heavy". I'm guessing that since you are showing movies that there > aren't too many of them, but if there were, you might eventually run > into performance issues. Lean-and-mean renderers are almost always > written in Actionscript. On my blog (blogs.adobe.com/aharui) I have > some examples. > > > > This renderer also uses states w/o transitions just to switch between > two views. Renderers get recycled as you scroll and the state switching > could be expensive since add/remove is slower than changing the visible > flag. > > > > Because you used a container and are using databinding to fill out the > fields, you probably don't need to override the data setter at all > because commitProperties is probably not needed (in fact, you didn't > implement and override). You also probably do not have to implement a > mapping to your value object. You'll save a few microseconds here and > there by doing so, but may not be worth the effort. > > > > Thus, in its most reduced form, this renderer could look more like this > (you might need some code for positioning and sizing): > > > > <mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml > <http://www.adobe.com/2006/mxml> " width="100" > height="120" > horizontalScrollPolicy="off" verticalScrollPolicy="off" > borderStyle="solid" > > <mx:Script> > <![CDATA[ > private function swfLoadHandler(e:Event):void{ > var swfContent:MoveClip = e.target.content as MovieClip; > swfContent.stop(); > }]]> > </mx:Script> > <mx:Image id="thumbImage" maintainAspectRatio="true" > source="{'images/'+ data.img}" scaleContent="true" height="95%" > width="95%" visible="{data.img.length > 0}" x="?" y="?" /> > </mx:VBox> > <mx:Label id="theCaption" width="100%" text="{data.caption}" > textAlign="center"/> > <mx:SWFLoader id="movie" > source="{'movies/'+data.swf}" maintainAspectRatio="true" width="95%" > height="95%" scaleContent="true" visible="{data.swf.length > 0}" /> > </mx:Canvas>
I'm using a mapping to my MediaElement object because that object is contained in the source ArrayCollection and is also used to drive the "large" image viewer. The stop action doesn't actually work on Flash 6 files, which these have to be because they also need to run in Authorware, which hasn't had an upgrade to its Flash Xtra in about 5 years and never will now. It doesn't seem that you can actually get older Flash movies to stop from Flex without adding functionality and recompiling. I have to say that it seems that silly things like effects have been made easy in Flex, yet serious things, like controlling older swfs easily, have been made seriously difficult. You also forget that part of the goal is to be able to use the component _not_ as an ItemRenderer, or as an ItemRenderer where it is being called from a Repeater component. So while you can just look at data directly, what then happens when you go to use it not as an itemrenderer? My understanding is if you set a component's visible property to false, it will still take up space on the screen as if it were visible, so I'm a bit unsure of what you're doing here. -Amy

