Hi,

I think the best way is to create a new component that will hold the image
and the floating components and handle visibility of these components
through states.

Example:

<?xml version="1.0" encoding="utf-8"?>
<s:Group
    xmlns:fx="http://ns.adobe.com/mxml/2009";
    xmlns:s="library://ns.adobe.com/flex/spark"
    xmlns:mx="library://ns.adobe.com/flex/mx"
    >

    <s:states>
        <s:State name="normal" />
        <s:State name="loading" />
        <s:State name="error" />
    </s:states>

    <fx:Script>
        <![CDATA[
            [Bindable]
            public var source:Object;
        ]]>
    </fx:Script>

    <mx:Image
        id="image"
        source="{source}"
        complete="{currentState = 'normal'}"
        progress="{currentState = 'loading'}"
        ioError="{currentState = 'error'}"
        />

    <s:Label top="0" right="0" text="Loading..." includeIn="loading" />
    <s:Label top="0" right="0" text="Error!" includeIn="error" />
</s:Group>


Of course you can put any states you like and also set states from outside
with : mainImage.currentState = "....".

Hope this helps,

Haykel Ben Jemia

Allmas
Web & RIA Development
http://www.allmas-tn.com




On Thu, Aug 26, 2010 at 9:50 PM, dorkie dork from dorktown <
[email protected]> wrote:

>
>
> Is there a way to constrain one component to another component? I've looked
> at constraint rows and constrain columns in the past but I haven't got it to
> work myself. IE,
>
> <Group id="imageContainer" width="500" height="500">
>  <Image id="mainImage" width="100" height="100" verticalCenter="0"
> horizontalCenter="0"/>
> </Group>
>
> <Image source="download.jpg" toolTip="Download this image"
>    right="[Right edge of main image]" top="[Top edge of main image]"/>
>
> In this example the download icon would float in the upper right corner of
> the image component as the image component floats in the middle of the
> container it is in. FYI In this project there are additional components that
> will float relative to the location and size of the image as well.
>
> JP
>  
>

Reply via email to