Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 07-24-2008, 02:27 PM   #1
rdoyle720
Registered User
 
Join Date: Jul 2008
Posts: 5
Default positioning

I'm VERY new to Flex. I copied and pasted some sample code that resizes an image. Very simple stuff.

To see how other controls reacted to the resizing, I placed a button under the image.

Before the image resizes, the button is about 5px away from the image. After the image resizes, the button is about 40px away from the image. From that point on, it stays about 40px away, even if I size the image down.

I'm not sure why this is happening. How can I get the position to stay consistent (5px away)?

Code:
<?xml version="1.0"?>
<!-- Simple example to demonstrate the Resize effect. -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">

    <mx:Resize id="expand" target="{img}" widthTo="250" heightTo="250"/>
    <mx:Resize id="contract" target="{img}" widthTo="30" heightTo="60"/>

    <mx:Panel title="Resize Effect Example" width="100%" height="100%" 
        paddingTop="10" paddingLeft="10" paddingRight="10" paddingBottom="10">

        <mx:Text width="100%" color="blue" text="Use the Button controls to resize the image."/>

        <mx:Image id="img" source="@Embed(source='../assets/todd.jpg')"/>
        <mx:Button label="Button"/>

        <mx:ControlBar>
            <mx:Button label="Expand" click="expand.end(); expand.play();"/>
            <mx:Button label="Contract" click="contract.end(); contract.play();"/>
        </mx:ControlBar>

    </mx:Panel>
</mx:Application>
rdoyle720 is offline   Reply With Quote
Old 07-24-2008, 03:44 PM   #2
NOCer
Registered User
 
Join Date: Jul 2008
Posts: 40
Default

ok the code you posted works fine for me so here is my guess.

your img is not a square and the Resizer is making it a square giving it white space below the img.

try playing with the widthTo and heightTo

ActionScript Code:
<mx:Resize id="expand" target="{img}" widthTo="250" heightTo="250"/> <mx:Resize id="contract" target="{img}" widthTo="30" heightTo="60"/>

also another route would be the heightBy liveDocs


Also try giving your img a width and height the same as on of your resizers

ActionScript Code:
<mx:Image id="img" source="@Embed(source='../assets/todd.jpg')" width="250" height="250"/>




Good luck and I hope you like flex. I only started a few months ago and I love it so far
NOCer is offline   Reply With Quote
Old 07-24-2008, 06:12 PM   #3
rdoyle720
Registered User
 
Join Date: Jul 2008
Posts: 5
Default

That's EXACTLY what was happening. Kind of a "duh" moment for me. Thanks for the help!
rdoyle720 is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
going mad on osx style dock positioning - please help overbyte ActionScript 2.0 2 06-10-2008 09:43 AM
Stage Resize and positioning MCs RefreshGFX ActionScript 2.0 2 01-12-2008 12:24 AM
ComboBox positioning penmig Components 2 11-24-2005 01:41 AM
rollovers don't work with absolute positioning SeanPaul72 Server-Side Scripting 2 02-24-2003 02:07 PM
Positioning labadi ActionScript 1.0 (and below) 6 05-14-2002 09:11 AM


All times are GMT. The time now is 02:19 PM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.