5 Replies Latest reply on Jun 22, 2007 10:43 PM by kglad

    Please check this affirmation about copyPixels

    OlandoCR Level 1
      Dear all,

      Please tell me if this affirmation is correct:

      I have this code

      var myMC:mcSet = new mcSet(832,576); // an image in the library
      var titleBitmap:Bitmap = new Bitmap(myMC);

      var _map:BitmapData = new BitmapData(1920,1440,false, 0xffffffff);// image holder

      var _bitmap:BitmapData = new BitmapData(512,416,false, 0xffffffff); //part of _map I want to render
      var image:Bitmap = new Bitmap(_bitmap);
      image.x =xOffset;
      image.y = yOffset;
      this.addChild(image);

      Now I populate _map


      function fillMap (){
      ….
      rect = new Rectangle(posX,posY,widthRect,heightRect);
      position = new Point (newPosX,newPosY);
      _map.copyPixels(titleBitmap.bitmapData,rect,position);
      ….
      }

      And now I populate _bitmap:


      function fillBtimap (){

      rect = new Rectangle(posX,posY,widthRect,heightRect);
      positiont = new Point (newPosX,newPosY);
      _bitmap.copyPixels(_map,rect,position);

      }
      Ok, this is my assumption:

      Because _map has already my image in memory, when I populate _bitmap using _map, I am not adding extra data to memory; I am just making reference to memory. Is this correct?

      I will appreciate your feedback