1 Reply Latest reply on Mar 7, 2010 10:24 AM by acid king

    need tweener/as2 expert for a small job

    acid king Level 1

      very simple, i have a background tiled to fill the complete background using caurina script, i need the background to pan around  (also using caurina) when the keyboard arrow keys are pressed.

      can send you the file with the background tiled.

      thanks.

        • 1. Re: need tweener/as2 expert for a small job
          acid king Level 1

          Bump

          Below is the piece of code, and here you can download the FLA :

          http://www.yousendit.com/transfer.php?action=check_download&ufid=S1VBUGhTVnNRR2RjR0E9PQ&ke y=a3eebdf174ed50e8144f0c62d30f397a35c92480&bid=RmNEa3NhZy9wcFUwTVE9PQ

           

          Would appreciate the help and would pay for your efforts.

           

          Here are the key problems:

          • Upon clicking and draging, tile is meant to change colour and it does, but on resizing the window, the colour resets
          • Upon making the window size exceedingly wide the colour function doesn't work
          • Tile disappears after draging about 2 tiles margin from the window edges, i need it to appear as if it doesn't finish
          • Tile doesn't appear in the minus, only in the plus of y and z coordinates

           

          import caurina.transitions.*;

           

          import ascb.util.Proxy;

           

          class bg.background extends MovieClip


          {
              private var bg:MovieClip;
                  private var bgIdx:Number = 0;
                 
              private var grad:MovieClip;
             
              public function background() {
                  bg = this["bg"];
                  grad["up"]._y = -4;
                  loadStageResize();
                  Tweener.addTween(this, { _alpha:100, time: .5, transition: "linear" } );
              }

           


              private function resize(w:Number, h:Number) {
                  grad["up"]._width = grad["down"]._width = w + 4;
                  grad["down"]._y = Math.round(h - grad["down"]._height + 4);
                 
                 
                  backgroundResize(w, h);
              }
             
              private function onResize() {
                  resize(Stage.width, Stage.height);
              }
             
              private function loadStageResize() {
                  Stage.addListener(this);
                  onResize();
              }
             
              private function backgroundResize(w:Number, h:Number) {
                  /**
                   * this will resize the background, the background is formed by many squares multiplied to fill the whole screen
                   */
                  var posX:Number = 0;
                  var posY:Number = 0;
                 
                  if ((bg._width < w) || (bg._height < h)) {
                      var i:Number = 1;
                     
                      while (bg["copy" + i]) {
                          bg["copy" + i].removeMovieClip();
                          i++;
                      }
                     
                      while (posX < w) {
                          bgIdx++;
                          posX += bg["copy"]._width;
                          var duplicate:MovieClip = bg["copy"].duplicateMovieClip("copy" + bgIdx, bg.getNextHighestDepth(), { _x:posX, _y:posY } );
                          if (posX >= w) {
                              posX = -bg["copy"]._width;
                              posY += bg["copy"]._height;
                          }
                          if (posY > h) {
                              break;
                          }
                      }
                  }
              }
          }