6 Replies Latest reply on Feb 19, 2011 9:25 AM by adninjastrator

    Can not center Html flash file in a browser..

    Ziedrich Level 1

      Hi all,

       

      After i publish a flash project and try to open the html file with a browser it is always at the left of the browser, why?

      In addition i have some problems with size too..

       

      What is the size of the browser's area for viewing any content(i mean the parts below the navigation tabs to start menu)?

      How can i adjust my project to this?

       

      Thx for helping.

       

      Note: My html settings seems true, it says "center center" but i dont know how to solve this.

        • 1. Re: Can not center Html flash file in a browser..
          kglad Adobe Community Professional & MVP

          what's your url or html code?

          • 2. Re: Can not center Html flash file in a browser..
            Ziedrich Level 1

            well my html code comes from the adobe flash cs4 and as3...i mean it is flash

             

            there is my simple code to change the bg image every 8 sec

            /********************************************************/

            import fl.transitions.Tween;
            import fl.transitions.TweenEvent;
            import fl.transitions.easing.*;

             

            DoSomething();

             

            function DoSomething():void
            {/**************ANA BOLUM**********************/

             

            var m_randomnumber:Number = Math.ceil(Math.random()*10);
            uiloader.source = "images/Bkgd"+m_randomnumber+".jpg";

             

            var Alpha:Tween = new Tween(uiloader, "alpha", Regular.easeOut, 0, 1, 1.5, true);

             

            var devam:Boolean = true;

             

            var i:int = 1;
            var zaman:Timer = new Timer(1000, 100);

             

            zaman.addEventListener(TimerEvent.TIMER, zaman_fonksyion);
            zaman.start();

             

             

             

            function yeni(evt:Event):void
            {
                var randomnumber:Number = Math.ceil(Math.random()*10);
                uiloader.source = "images/Bkgd"+randomnumber+".jpg";
               
                var myTween2:Tween = new Tween(uiloader, "alpha", Regular.easeOut, 0, 1, 1.2, true);
               
               
            }
            function zaman_fonksyion(event:TimerEvent):void
            {
               trace(i);

                i++;
              
               if(i!=99)
               {
                  if(i%8==0)
                  {
                      var myTween:Tween = new Tween(uiloader, "alpha", Regular.easeOut, 1, 0, 1.2, true);
                     
                    
                    
                      myTween.addEventListener(TweenEvent.MOTION_FINISH,yeni);
                 }
               }
               else
               {
                    i = 1;
               }
               
            /***************************************************/

            when i publish this project and try to open in a browser it is always at the left of the browser like aligned to it..

             

            size is 1000x700

            • 3. Re: Can not center Html flash file in a browser..
              kglad Adobe Community Professional & MVP

              what's your url?

              • 4. Re: Can not center Html flash file in a browser..
                Ziedrich Level 1

                well pardon me but i didn't understand what you meant by saying my url, if you mean "My_Website.html" the name of the publish file or

                you could mean "file:///C:/Users/MERT/Documents/My_flashwebsite/My_Website.html" the source is my computer here it is.

                • 5. Re: Can not center Html flash file in a browser..
                  kglad Adobe Community Professional & MVP

                  upload your files to your server and post that url.

                  • 6. Re: Can not center Html flash file in a browser..
                    adninjastrator Level 4

                    The placement of your .swf on a Web page and it's alignment in the browser window is a function of HTML and CSS (styling of the Web page), it has nothing to do with the Flash .swf. Remember, there is no such thing as a Flash Web site... only HTML, PHP, ASP, etc. Web sites that have some Flash content.

                    While you can use Flash to auto generate that HTML, it's only a generic solution, really only meant to test the .swf on a Web page, and usually generates excessive and un-needed code... but it does let you see the .swf on a Web page.

                    So depending on whether or not your .swf is to take up the entire Web page or just be one component of the Web page, you may need to use slightly different code to correctly place the .swf on the Web page, set the top margin, center the .swf, etc. To review a few basics on the layout of a Web page, here is a great source:

                    http://www.w3schools.com/html/default.asp

                    As for sizing, are you wanting the .swf to always stay the same size or "scale" as the browser window expands or shrinks?

                    Best wishes,

                    Adninjastrator