9 Replies Latest reply on Jun 9, 2010 7:07 AM by Chorale0001

    Need help to figure this.




      I am trying to build a flash that auto-adjust its size to the browser window size, while leaving the content of the flash itself top-centered in the screen.


      I have found this solution http://www.kirupa.com/developer/as3/resizing_centering_as3.htm on How to keep centered stuff in this exact case so i am pretty confident i will be able to adjust that script to do what i want.


      Now my problem is that if i put my content inside the movie-clip (centerrectangle) with all the animation require, link and other stuff, the movieclip (center rectangle ) never have the exact same center, thus making the script go wild trying to always adjust the location to the variable size of the movie clip...


      I need it to stay exactly at the same position whatever the size of the movie-clip.


      This is for a Menu with sub-menu, so when the sub-menu open ( for exemple) the center of the movie-clip is no longer the same.


      Any idea how to fix that ?


      Here is a Crude exemple of what i mean:




      Try to resize the window of your browser , you'll notice the center is not always the same. The blue pattern should always stay at the same location.


      Thanks a lot.


      This is AS3 By the way.


      Message was edited by: Chorale0001. Fixing link

        • 1. Re: Need help to figure this.
          Chorale0001 Level 1

          Fixed a couple thing in the post. Go ahead.

          • 2. Re: Need help to figure this.
            PJSB_DK Level 3



            hehe..It's looking funny, though

            I've tried it and the code works perfectly.

            It must be some of your other stuff that's doing it.

            Looks like the resizing happens at

            the wrong time.(just a guess).


            Best regards


            • 3. Re: Need help to figure this.
              Chorale0001 Level 1

              Good. So the code is ok.


              Then i don't understand why it is working like.. well.. that.


              In my exemple i've just added 2 patern than move, nothing else, both are in the movie-clip of the blue patern.


              I still don,t get it.

              • 4. Re: Need help to figure this.
                PJSB_DK Level 3

                You got the 2 animations inside the small movieclip?

                Thought the were outside..

                Your movieclip resizes during animation..

                Try this:

                draw a rectangle inside your movieclip.

                Make the rectangle the same size as the mc.

                try again.

                if that won't work...

                Are your registration points

                set correctly in the movieClip?

                • 5. Re: Need help to figure this.
                  Chorale0001 Level 1



                  Here is the FLA of the exemple. I'll try what you are suggesting.

                  • 6. Re: Need help to figure this.
                    PJSB_DK Level 3

                    It'll work..

                    Just make the rectangle so that it covers the entire

                    animation span.


                    Best regards


                    1 person found this helpful
                    • 7. Re: Need help to figure this.
                      Chorale0001 Level 1

                      Ok it's working thanks !


                      But now i have another question. I need to have 7 scene to have my menu perform all the action require, however the thing to keep it centered work only in the current scene, and as soon i change of scene , it is not longer working.


                      So i try to duplicate the 2 movieclip in each scene and there i've hit a little wall.. Though i manage to copy succesfully the MC, the content of the central MC need to be different from scene to scene, so basiquely, i need to construct 7 central MC and the script need to work for all of them.


                      Do i simply need to duplicate the



                      //center content
                      centerRectangle.x = stage.stageWidth/2 - centerRectangle.width/2;
                      centerRectangle.y = stage.stageHeight/2 - centerRectangle.height/2;


                      while renaming each time the name of the central MC ?..


                      I should be working yes ? with no apparent transition between the central MC #1 ( scene 1 ) to the Central MC #2 ( Scene 2)


                      Correct ?

                      • 8. Re: Need help to figure this.
                        PJSB_DK Level 3



                        i'm unsure of, what you're trying to accomplish here...


                        If you wish the use the same animation in all frames, then just extend the

                        frames so, that it displays in all frames..No need to copy/duplicate

                        unless you want to change something in the mc.


                        Just keep the movieclip an a seperate layer...and extend..


                        Best regards


                        • 9. Re: Need help to figure this.
                          Chorale0001 Level 1

                          Hum, I'll try to be more detailed.


                          I have an AS2 flash which contain a menu that zoom/unzoom, with sub-menu, including detection zone when you move out and etc.ect.etc. This flash file is build in 7 scene for the sake of readeability and ability to edit/update later on. You can read the file as follow :


                          - Scene 1 : idle status ( shows only 1 button ) with all link script and all Geturl

                          - Scene 2 : zoom in animation

                          - scene 3 : open status ( Submenu closed )

                          - Scene 4 : zoom ou animation back to scene 1

                          - Scene 5 : Open status ( submenu opening animation )

                          - Scene 6 : Fully open menu ( submenu open)

                          - Scene 7 : Open status ( submenu closing animation ) leading both to Scene 4 and 3 depending of the option.


                          Each closing animation lead at different point from the other, so it is a bit complicated.


                          Though it is possible to put all this in the same Scene and navigate using Goto command, it is much more easier to edit in that form.


                          So since i need to redo that menu in AS3 with the center thing script, my question are :

                          - Can i apply the script to each scene without busting myself ?

                          - Do i need to reconstruct everything in the same Scene ?

                          - Do i need to duplicate ( and rename the require MC ) the script and its component in each scene ?

                          - Will all those duplicated ( with different Mc name ) work without causing conflict ?

                          - Will the transition between each scene and script allow a flawless transition without having the menu "shake" itself half a second while the script recenter everyone ? For it is critical that the menu stay exactly at the same location all the time, Everything depent of that.


                          Thanks for your help


                          Best regards