are you expectiong something like this:

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";
layout="vertical">
<mx:Script>
        <![CDATA[

                private function fitToBox(evt:Event):void{
                        var box:Object=evt.target
                        var img:Object=box.content
                        var w:Number=img.width
                        var h:Number=img.height
                        var whR:Number=h/w
                        var hwR:Number=w/h

                        var boxW:Number=box.width
                        var boxH:Number=box.height

                        if(boxW>=boxH){
                                img.width=boxW
                                img.height=boxW*whR
                        }else{
                                img.height=boxH
                                img.width=boxH*hwR
                        }
                        var dx:Number=(boxW-img.width)/2
                        var dy:Number=(boxH-img.height)/2
                        img.x=dx
                        img.y=dy
                        trace(w,h,img.width,img.height,img)
                }
        ]]>
</mx:Script>

        <mx:Image width="100" height="200" scaleContent="false"
source="assets/image.jpg" creationComplete="fitToBox(event)"/>
        <mx:Image width="120" height="230" scaleContent="false"
source="assets/image.jpg" creationComplete="fitToBox(event)"/>
        <mx:Image width="100" height="600" scaleContent="false"
source="assets/image.jpg" creationComplete="fitToBox(event)"/>

</mx:Application>

On Dec 10, 6:51 pm, rohit <rohitde...@gmail.com> wrote:
> Actually i have a number of boxes of different sizes.and user can
> upload the image of any size inthat.
>
> what I need that image must not be stretched in any box.No probes if
> image goes to cut to fit in the box.
>
> How can I do this.
>
> On Dec 10, 5:55 pm, sri space hero <sritejnar...@gmail.com> wrote:
>
> > Helo,
>
> > How can u make it cover the whole box, though maintaining its aspect ratio.
>
> > Image size is fixed either u must maintain ur box of that size or keep the
> > maintain aspect ratio to false.
>
> > or u can create a separate image of ur like using photoshop and use it :)
>
> > On Thu, Dec 10, 2009 at 4:42 PM, rohit <rohitde...@gmail.com> wrote:
> > > I have three boxes having size 100*200,120*230,100*700
>
> > > my image size is 400*400
>
> > > I want to fit my image into every box but without stretched.Means it
> > > maintain proportion(maintain aspect ration= true)
>
> > > but need to cover full box
>
> > > --
>
> > > You received this message because you are subscribed to the Google Groups
> > > "Flex India Community" group.
> > > To post to this group, send email to flex_in...@googlegroups.com.
> > > To unsubscribe from this group, send email to
> > > flex_india+unsubscr...@googlegroups.com<flex_india%2bunsubscr...@googlegroups.com>
> > > .
> > > For more options, visit this group at
> > >http://groups.google.com/group/flex_india?hl=en.
>
> > --
> > Regards,
>
> > Sri Tej
> > Golive Gaming Solutions PVT LTD

--

You received this message because you are subscribed to the Google Groups "Flex 
India Community" group.
To post to this group, send email to flex_in...@googlegroups.com.
To unsubscribe from this group, send email to 
flex_india+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/flex_india?hl=en.


Reply via email to