OK, glad you got it working.  I didn't see those properties either.

 

FWIW:

 

Your example had verticalAlign="bottom" which would force the hlist to
the bottom but also was a factor in the images/movies moving up and
down.  I think you may want to use "absolute" layout and constraints.

 

If you put real xml in your .xml file, you can load it via HTTPService
instead of going through ExternalInterface.

 

I had changed ImgViewer to look like this.  It seems simpler as it
reuses the same Image tag for both images and movies.  You can remove
centerImage() and use the align styles instead

 

<?xml version="1.0" encoding="utf-8"?>

 

<mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml"; 

            backgroundAlpha="1.0" 

            verticalScrollPolicy="off" horizontalScrollPolicy="off"
borderStyle="none" >

<mx:Script>

            <![CDATA[

                        import vo.MediaElement;

                        import mx.effects.Fade;

 

                        private var _me:MediaElement;

 

                        [Bindable("mediaObjectChanged")]

                        public function get mediaObject():MediaElement

                        {

                                    return _me;

                        }

 

                        public function set
mediaObject(me:MediaElement):void

                        {

                                    _me = me;

                                    dispatchEvent(new
Event("mediaObjectChanged"));

                        }

 

                        [Bindable("mediaObjectChanged")]

                        public function get sourceURL():String

                        {

                                    if (!_me) return '';

 

                                    if (_me.imgSrc != '')

                                                return 'images/' +
_me.imgSrc;

 

                                    return 'movies/' + _me.swfSrc;

                        }

 

                        public function centerImage():void

                        {

                                    if (!imgCtrl.content)

                                                return;

 

                                    // if not as wide, center it

                                    imgCtrl.x = (width -
imgCtrl.content.parent.width) / 2

                        }

                        

            ]]>

</mx:Script>

            <mx:Image id="imgCtrl" maintainAspectRatio="true"
source="{sourceURL}" scaleContent="true" 

                                    top="0" width="{width}"
height="{height - 20}"

                                    updateComplete="centerImage()"

                                    completeEffect="Fade" />

            

            <mx:Label id="captionLabel" text="{mediaObject.caption}"
height="20" bottom="0" horizontalCenter="0" color="#FFFFFF"/>

</mx:Canvas>

 

________________________________

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of droponrcll
Sent: Friday, October 05, 2007 10:29 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re: MultiPurpose ItemRenderer

 

--- In flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com>
, "Alex Harui" <[EMAIL PROTECTED]> wrote:
>
> Don't forget, this is a free volunteer service, and not my real 
job. If
> it takes more than a few minutes, I usually have to work on it at 
night
> unless my day suddenly clears up.
> 
> 
> 
> Anyway, I think I have it working and will try to respond in more 
detail
> soon.

I suppose it is comforting that it was more than a few minute fix for 
you, too. :-)

But I found that the Image tag does, in fact, have a verticalAlign 
and horizontalAlign property, which fixes the problem quite 
handily! :-)

Thanks!

Amy

 

Reply via email to