Raphael,

There are a few things you need for the code to work.  Below is how I
recommend changing it.

Your dataGrid's dataProvider is 'produtos', and each object within it
has an 'image' property.  I recommend having each of these point
directly to an Image object (as opposed to a String of the image's
source).  Something like this:

<mx:Image id="myImage" width="150" height="55">
        <mx:source>http://www.google.com/images/logo_sm.gif</mx:source>
</mx:Image>

/* (Then, within some initialization ActionScript method) */
// produto is some object with 'modelo' and 'linha' properties
produto.image = myImage;
produtos.addItem(produto);

Now, your resize effect doesn't need to specify the 'target',
'widthTo', or 'heightTo' properties.  The latter two specifications
are what I suspect was your main problem.  The effect doesn't happen
more than once because it's trying to be resized FROM width 300 TO
width 300.  Example:

<mx:Resize id="expand"/>

Lastly, images do have resize issues, as written about in the Flex
API.  So put your image inside a canvas, bounded to the sides, and
resize the canvas.  Example:

<mx:Canvas 
        resizeEffect="expand" 
        width="{(dgProducts.selectedItem as Image).width}" 
        height="{(dgProducts.selectedItem as Image).height}"
>
        <mx:Image
                id="img" 
                source="{(dgProducts.selectedItem.image as Image).source}"  
                x="10" y="10"
                left="0" right="0" top="0" bottom="0"
        />
</mx:Canvas>

That should be all you need.  Hope this helps.  If you have more
questions, don't hesistate to ask!

Nick Matelli | Consultant, Amentra Inc.
Email: [EMAIL PROTECTED]
1775 Wiehle Ave Suite 103, Reston VA 20190


--- In [email protected], "raphamaster20004"
<[EMAIL PROTECTED]> wrote:
>
> Hi,
> 
> I have one dataGrid and necessary that when the user to click in one
> determined item of the same it executes the Resize in an image, but it
> executes only one time the effect, in the image, being that when click
> in the effect does not happen again.
> 
> This is my code:
> 
> <mx:Resize id="expand" target="{img}" widthTo="300" heightTo="250"/>
> 
> <mx:DataGrid id="dgProdcts" dataProvider="{produtos}" x="284" y="28"
> height="151" width="406" click="expand.play();">
>                 <mx:columns>
>                         <mx:DataGridColumn headerText="Nome"
> dataField="modelo"/>
>                         <mx:DataGridColumn headerText="Linha"
> dataField="linha"/>
>                 </mx:columns>
> </mx:DataGrid>
> 
> <mx:Image source="{dgProducts.selectedItem.image}" x="10" y="10"
> width="30" height="60" id="img"/>
> 
> tanks for attention
> 
> Raphael
>


Reply via email to