10 Replies Latest reply on Mar 5, 2007 8:52 PM by routhu

    little help on Flash 100% width

    routhu
      Hi to all,

      I am new in actionscrip.

      I have developed this code for variable width gallery.
      But I want the Image to be changed proportional with respect to window, No Stretching will be happen while dragging the window.

      Below code belongs to that one.

      Can any one Please Help me to solve this Problme.


        • 1. Re: little help on Flash 100% width
          routhu Level 1
          Any One?
          • 2. Re: little help on Flash 100% width
            tonyhigham Level 1
            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. ;)
            • 3. little help on Flash 100% width
              routhu Level 1
              Hi tonyhigham,

              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.

              http://www.theinfantphotographer.com/content/gallery/infant_colour/ind ex.html
              • 4. Re: little help on Flash 100% width
                tonyhigham Level 1
                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

                function expandImage():Void{
                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...
                • 5. little help on Flash 100% width
                  routhu Level 1
                  Hi tonyhigham,

                  I have used that Code , But not working. The code is still confusing me.

                  I have no server to Provide the link.

                  Can you plz help me . I am struggling from the last one week.

                  Thanks
                  Krishna
                  • 6. Re: little help on Flash 100% width
                    routhu Level 1
                    Hi tonyhigham ,

                    I am using the below code. But here is my problem . In the starting the image is stretching , if i done any operation like minimising or Maxmising I get the correct Image.
                    I need to solve that Starting Image stretching problem.
                    Can You plz help me to Solve this one.

                    Thanks,
                    Krishna
                    • 7. Re: little help on Flash 100% width
                      tonyhigham Level 1
                      Krishna,
                      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:

                      stageListener.onResize()



                      As for your expand image function, it looks like you're trying to maximize the picture based on the large dimension. Try:
                      • 8. Re: little help on Flash 100% width
                        routhu Level 1
                        Hi tonyhigham,

                        Can you please download my source code, this is the url :
                        http://www.ourwebstudio.com/test.zip
                        That problem still not solved.
                        Can you please look into that one. I am waiting for your repley.

                        Thnaks
                        Krishna my source code
                        • 9. Re: little help on Flash 100% width
                          tonyhigham Level 1
                          Krishna,
                          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.
                          • 10. little help on Flash 100% width
                            routhu Level 1
                            Hi tonyhigham,

                            Greate Job, this is working fine now.

                            Thanks a lot for your help..

                            Can you do one more favour to me, I need the image to be aligned center, when ever I stretch the window. This problem is comming to me when ever I upload the small image

                            Thanks,
                            Krishna