[flexcoders] I have an image inside a canvas container, and when I resize the canvas, the ima

2005-08-08 Thread zhongtie
I have an image in a canvas container, and when I resize the canvas,
the image resizes as I expect. However, the image position doesn't
change at all, unlike in a Flash applicaiton.

For example, on a 300x300 canvas, I load an image of 100x100 at (100,
100). If I double the size of the canvas to 600x600, the image is
automatically resized to 200x200, BUT still at (100, 100), instead of
(200, 200)!!

What will be the solution for this? Please help!

Thanks in advance!!

Tim


 Sample Code 
== Please replace your_image_here.jpg with any JPG file   ===
== in the same dir===
=


Attach Code

?xml version=1.0 encoding=utf-8?
mx:Application xmlns:mx=http://www.macromedia.com/2003/mxml;
mx:Script
![CDATA[
var zoomIn:Boolean = false;
function onClick():Void
{
zoomIn = !zoomIn;
if (zoomIn) {
frame.width = 200;
frame.height = 160;
} else {
frame.width = 400;
frame.height = 320;
}
}
]]
/mx:Script
  mx:Button label=zoom click=onClick()/
  mx:Canvas width=400 height=320 id=frame
backgroundColor=#99
  mx:Image source=your_image_here.jpg  
x=100 y=100 width=50% height=50%/
  /mx:Canvas
/mx:Application







 Yahoo! Groups Sponsor ~-- 
font face=arial size=-1a 
href=http://us.ard.yahoo.com/SIG=12haa0tbn/M=362131.6882499.7825260.1510227/D=groups/S=1705007207:TM/Y=YAHOO/EXP=1123550959/A=2889191/R=0/SIG=10r90krvo/*http://www.thebeehive.org
Get Bzzzy! (real tools to help you find a job) Welcome to the Sweet Life 
- brought to you by One Economy/a./font
~- 

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links

* To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/

* To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]

* Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
 




Re: [flexcoders] I have an image inside a canvas container, and when I resize the canvas, the ima

2005-08-08 Thread JesterXL
By default, Flash does not align the Stage to the top left, and scales 
depending on the HTML written.

Flex, however, does it like an app:
- doesn't scale
-aligns to top left

If you want your image to scale, you should probably change it's 
scaleX/scaleY, or turn off scaleContent/maintainAspectRatio, and alignt it 
to 0,0.

- Original Message - 
From: zhongtie [EMAIL PROTECTED]
To: flexcoders@yahoogroups.com
Sent: Monday, August 08, 2005 6:09 PM
Subject: [flexcoders] I have an image inside a canvas container, and when I 
resize the canvas, the ima


I have an image in a canvas container, and when I resize the canvas,
the image resizes as I expect. However, the image position doesn't
change at all, unlike in a Flash applicaiton.

For example, on a 300x300 canvas, I load an image of 100x100 at (100,
100). If I double the size of the canvas to 600x600, the image is
automatically resized to 200x200, BUT still at (100, 100), instead of
(200, 200)!!

What will be the solution for this? Please help!

Thanks in advance!!

Tim


 Sample Code 
== Please replace your_image_here.jpg with any JPG file   ===
== in the same dir===
=


Attach Code

?xml version=1.0 encoding=utf-8?
mx:Application xmlns:mx=http://www.macromedia.com/2003/mxml;
mx:Script
![CDATA[
var zoomIn:Boolean = false;
function onClick():Void
{
zoomIn = !zoomIn;
if (zoomIn) {
frame.width = 200;
frame.height = 160;
} else {
frame.width = 400;
frame.height = 320;
}
}
]]
/mx:Script
  mx:Button label=zoom click=onClick()/
  mx:Canvas width=400 height=320 id=frame
backgroundColor=#99
  mx:Image source=your_image_here.jpg
x=100 y=100 width=50% height=50%/
  /mx:Canvas
/mx:Application








--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
Yahoo! Groups Links








 Yahoo! Groups Sponsor ~-- 
font face=arial size=-1a 
href=http://us.ard.yahoo.com/SIG=12hrl4oti/M=362131.6882499.7825260.1510227/D=groups/S=1705007207:TM/Y=YAHOO/EXP=1123560949/A=2889191/R=0/SIG=10r90krvo/*http://www.thebeehive.org
Get Bzzzy! (real tools to help you find a job) Welcome to the Sweet Life 
- brought to you by One Economy/a./font
~- 

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links

* To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/

* To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]

* Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/