8 Replies Latest reply on Apr 19, 2012 12:53 PM by johnpaok

    Basics stage and background

    johnpaok

      Hi,

       

         I put on my app on my background picture. When I run it with cwf everything is ok. But, when I run myapp on my Emulator I see a change about the stage and the picture. My pictoure is smaller. How can I fix it? May it's problem of emulator? what is the scal content?, the choise of settings stage-backgraound

        • 1. Re: Basics stage and background
          johnpaok Level 1

          I don't give instance name of any picture Must I do to control the image? Also, I tick on the emulator the "unknown "form factor".

          • 2. Re: Basics stage and background
            sinious Most Valuable Participant

            In the emulator you get to choose an android platform version as well as a device profile. The profile states the resolution of the device that the emulator must mimic. You must make sure your background is at least that size.

             

            On android you're going to see that many other resolutions and aspects come into play. Although this is specific to android development, here's a link full of things to keep in mind about pixel differences:

             

            http://developer.android.com/guide/practices/screens_support.html

             

            You will need some code to adjust the background to the correct size. You can always check what the stage.stageHeight and stage.stageWidth actually is to help you.

            • 3. Re: Basics stage and background
              johnpaok Level 1

              I can't understand why the background is 320-380 of all frames "3" and the picture is 320-380 size and I save it as symbol and my emulator only (not when I run my app with cwf) makes smaller my picture

              • 4. Re: Basics stage and background
                sinious Most Valuable Participant

                Check the DPI setting you used. If you're targeting a specific device you need to tell your project which DPI to target. For a phone 240 is a safe DPI. For an iPad you can go legacy at 160DPI just for compatibility. This may be making things harder on you although Flash should compensate for your desired height/width regarding the DPI.

                 

                Why don't you trace() the width and height of the object,  see if you get back 320 and 380 as you expect.

                • 5. Re: Basics stage and background
                  johnpaok Level 1

                  how can I write this?

                   

                  nameSymbol-instancenameOfMyPictrace("Height,width");???????? like this? the probles is in the height

                  • 6. Re: Basics stage and background
                    johnpaok Level 1

                    You check this post

                     

                    http://forums.adobe.com/message/2705364

                     

                    and

                     

                    You cannot change the width and height properties of the Stage using code--it must be done in the editor.  The width and height values can represent different things depending on the value you set for the scale mode, but you cannot reassign them to different values dynamically.

                     

                    The solution just offered to you is under the same rules, the stageWidth and stageHeight values cannot be assigned using code, but that code is AS3 code so it will not fit in your AS2 design in any case.

                     

                    The same goes for the followup offered in AS2.  You will notice the stage size is not being changed... it cannot be.  This is just a full screen design solution, but is not a soltuion to changing the stage size.  The stage size can only be changed manually in the authoring environment.  I don't know that the offering is answering what you are really trying to do, but it is not answering the titled task of dynamically changing the stage size

                    • 7. Re: Basics stage and background
                      sinious Most Valuable Participant

                      I'm not telling you to change the stage height or width. They will change automatically based on the device you load. It's up to you to read the width and height and take the appropriate actions to make your app usable.

                       

                      How you set the width and height of a display object is simple, but how the stage symbol got there is the question.

                       

                      Scenerio 1: You dragged the MovieClip into a frame in the timeline from the library

                       

                      1. Select the MovieClip.

                      2. Open the Properties panel (Window->Properties).

                      3. In the Instance Name field add a unique name for this MovieClip following variable name conventions. e.g. myBackground

                      4. If you already don't have one, make a new layer for actionscript

                      5. Create a blank keyframe where your MovieClip is on stage.

                      6. Set the height and width via this code:

                       

                      myBackground.width = 380;   // change to suit

                      myBackground.height = 320;   // change to suit

                       

                       

                      Scenario 2: You're programatically creating the MovieClip

                       

                      1. Create your MovieClip or Sprite (e.g. var myBackground:MovieClip = new SomeLinkageIDFromLibrary(); )

                      2. Add to display list (e.g. addChild(myBackground); )

                      3. Name the instance for easy access later (e.g. myBackground.name = "myBackground"; )

                      4. Set the dimensions of the newly created clip via this code:

                       

                      myBackground.width = 380; // change to suit

                      myBackground.height = 320; // change to suit

                       

                      In either scenario you do not set the stages height and width. The device will do that.

                      • 8. Re: Basics stage and background
                        johnpaok Level 1

                        I delayed because I had crash my adobe and I make again my app .....too match items in library (don't need the images must I incude in the public setting......)

                        I made the images as movie clips. But the code it's not acceped from my compiler. but I thing, the problem is the background which automatic resize when my app run on emulator 5554 android 2.3.3....

                         

                         

                        How can I lock my backgound-stage???