2 Replies Latest reply on Apr 16, 2008 1:33 AM by reborm

    NEWB questions

    reborm
      aight, im a uni student learning flash for the first time
      we are using actionscript 2
      we made this ufo thing today, and to move the ufo you use the up down left right keys
      ufo - http://uzi17.2ya.com/wk05
      i just got some questions about this

      1) how do i 'resize' it, cause as you can see on that link it takes up the whole screen. do i need to do something in flash, or do i 'resize' it on my html page? (note we are also learning how to use dreamweaver)

      2) when you fly the ufo off the screen, it just keeps going :|. how would you go about making it so if yo go off the screen on the right, the ufo will 'bounce' back into the screen, and the ufo can't go off the screen

      thanks :D

        • 1. Re: NEWB questions
          Level 7
          1. Look at your object that embeds the movie - you have the width and height
          both set to 100%. So it resizes to fit the browser. You can change the
          publish settings in Flash, or you can change those values to be the movie
          size like 550, 400 or whatever - make sure to leave out the % to use pixels.

          2. You have a key checking routine that adds or subtracts some speed value
          from the ufo's _x and _y properties. So, you need to check the ufo's
          position against the boundries when you do this. Say you're going left:

          if (left arrow down){
          ufo._x -= speed;
          if(ufo._x < 0){ //left edge of stage is 0
          ufo._x = 0;
          }
          }

          HTH

          --
          Dave -
          Head Developer
          http://www.blurredistinction.com
          Adobe Community Expert
          http://www.adobe.com/communities/experts/


          • 2. NEWB questions
            reborm Level 1
            hmmm... on my flash file it says it is 550x400
            i can't see anything that says 100%

            and as for preventing the UFO from going of the stage
            if (Key.LEFT){
            Ship._x -= speed;
            if(Ship._x < 0){ //left edge of stage is 0
            Ship._x = 0;
            }
            }

            i thought that would stop it but it doesn't