The image content is always at the top-left of the Image.  Based on
scaleContent, the Image will scale the content or try to shrink itself
down.  There are no 9 choices, the image content fully fills the Image
plus/or/minus extra space in order to maintain aspect ratio if
requested.  You use the parent container's layout to further position
the Image.  The VBox wrapper is trying to react to the new measured
sizes by adjusting the size and position of the Image and while it
should just work, sounds like something is off there.  If the image
content is a SWF you further complicate the problem because the SWF can
resize itself, but the Image is only checking the size of the first
frame.  Are your SWFs "well-behaved" in that they appear centered in
their stages and are aligned relative to the top-left and don't go into
negative coordinates?  It might require more code to deal with different
stage alignments.

 

I recommend you go with Canvas because that'll give you the most control
over positioning.

 

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of droponrcll
Sent: Monday, October 01, 2007 12:39 PM
To: [email protected]
Subject: [flexcoders] Re: Placement of Image within Image Control

 

--- In [email protected] <mailto:flexcoders%40yahoogroups.com>
, "Daniel Freiman" <[EMAIL PROTECTED]> 
wrote:
>
> On inspection it looks like I did what Alex is talking about.
> I'm a little confused at the sliding image issue. In my experience 
the
> loaded images are placed in the top left corner of the Image 
control unless
> you explicitly do something else.

Well, that is what it looked like at first, but what actually seems 
to happen is that the placement is quite arbitrary. The same image 
will always have the same placement, but two images of a similar size 
might have different placements. For instance if I have an image 
that is 300x100 and one that is 275x100, one of them will be at the 
top, the other at the bottom.

I find myself mystified as to why the image control doesn't just have 
properties that let you specify where the content is. In Authorware, 
when you import an image there's a little grid that lets you choose 
one of 9 placements for the image relative to where you imported it. 
This is great when you're replacing imported content dynamically, 
because you can align it how you want.

> You should be able to fit the Image control to the loaded image 
perfectly by
> doing something like this:
> 
> image.width = image.content.width;
> image.height = image.content.height;
> image.content.x = 0;
> image.content.y = 0;

Could that potentially make the content rescale again, resulting in 
an endless loop?

Thanks!

 

Reply via email to