I suggest your renderer look something like this. You'll see use of dataChange and how to center the image. I don't have a proxy example, but that's a good topic for a blog article someday... Can you post two image swfs that don't center correctly? I want to make sure those swfs are aligned to topleft otherwise this centering code won't work for you. <mx:Canvas dataChange="mediaObject= data as MediaElement"> <mx:Script> private var _mediaObject:MediaElement; [Bindable("mediaObjectChanged")] public function get mediaObject():MediaElement { return _mediaObject; } public function set mediaObject(value:MediaElement):void { _mediaObject = value; dispatchEvent(new Event("mediaObjectChanged"); } private function centerImage():void { img.x = (width - img.measuredWidth) / 2; img.y = ??? } </mx:Script> <mx:Image id="img" source="{mediaObject.imgSrc}" complete="centerImage()" /> ... HTH, -Alex
________________________________ From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of droponrcll Sent: Tuesday, October 02, 2007 7:06 AM To: flexcoders@yahoogroups.com Subject: [flexcoders] Re: MultiPurpose ItemRenderer --- In flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com> , "Alex Harui" <[EMAIL PROTECTED]> wrote: > > I see, if mediaObject you want to be your public interface to when you > use it as a component instead of a renderer, then I would set up my > bindings based on mediaObject instead of data. I'd probably just use a > dataChange="mediaObject = data as MediaElement" in the top level instead > of overriding the getter/setter. I don't know what this means. I haven't found any documentation that refers to this (and believe me I have spent literally hundreds of hours combing the Flex documentation). Could you point me to a reference so I can get more information? > In a Canvas there are no layout rules so you can place things on top of > each other and turn one or the other off and on with visibility. That's > what I would do and I would also calculate the centering solution then > as well. OK, bear with me as I go through this in pseudocode: on mediaObjectChange set img control to 100% measure content set img control from 100% to size of content determine where top left of img control needs to be for img to appear centered set x and y of img Yes? > With the advent of Actionscript 3 and the goal of maximized performance, > the Flash Player did not allow interoperability between FlashPlayer9/AS3 > SWFs and the ActionScript in older SWFs. You can use localConnection, > but that's about it. For those of you trying to integrate older swf > content, it has become much harder to do. You can use a proxy AS2 swf > to communicate to your older content. That way you only have to tweak > the one proxy swf instead of rebuild all of your older content. Is there an example proxy swf available for download? You know, I just realized I probably can't stop these movies anyway, since they are nested and the designer forgot to put the stopAllClips() function in most of them. Oh, well. Thanks; Amy