This content has been marked as final. Show 10 replies
What exactly do you mean by 'I want the Image to be changed proportional with respect to window?' Do you want the x and y coordinates to keep it centered? Do you want the image to fill the same proportion of the movie? Your code looks good so far, but I'm not sure what you want to happen in expandImage(). A little more detail about what you want, and we'll help you out. ;)
Thank for your reply.
I want the image exactly like in below link. Consider only large Image.
Whenever i stretch the window the Image has to behave like in the Below link.
Ok. It's still all little tough to be completely specific without seeing your layout, but it sounds like you just need to adjust your picture based on your design-time layout. For example:
//values before any resize takes place, ie design-time
//this assumes that picture is your container
var iX:Number = picture._x/Stage.width //initial x ratio
var iY:Number = picture._y/Stage._height //initial y ratio
var iW:Number = picture._width/Stage.width //inital width ratio
var iH:Number = picture._height/Stage._height //inital height ratio
picture._x = iX*Stage.width
picture._y = iY*Stage.height
picture._width = iW*Stage.width
picture._height = iH*Stage.height
This is just meant to be a general example, and the acualt implementation will of course depend on what you want things to look like. This is jsut meant to show how you would keep the container mc in the same realtive postion and at the same relative size as the stage is resized. Hope this helps...
If I understand you correctly, your images are resizing properly with the stage, but they don't start out sized properly? If thats the case, then just call your resize function when the movie loads. Right after you define the listener, call it:
As for your expand image function, it looks like you're trying to maximize the picture based on the large dimension. Try:
Paste the code below on to your action layer. It maximizes the image to its largest dimension, but also makes sure that the whole image is visible. The reason it wasn't resizing to begin with was that the movie hadnt finished loading when the reSize functions were called. You can see the code to accmomplish this at lines 22-24. However, this is a pretty messy fix, and would be GREATLY improved if you used the newer MovieClipLoader class instead of loadMovie. The MCL class gives you nice callbacks fo progress and completion, and a completion callback is just where you need to call the reSize function.