0 Replies Latest reply on Jul 7, 2006 9:53 AM by MichaelOG

    BitmapData to MovieClips

    MichaelOG Level 1
      Hi all
      I want to be able to feed a picture in to Flash, get it copied on to seperate MovieClips and then disintegrate the assembled picture using the Tween class. I'm having trouble getting the following code to get sections of a source MovieClip to be copied to seperate MovieClips using the BitmapData class. It works for the first clip but not for the others. The Tween does work by controlling each clip.
      All that's missing is a 400 x 300 picture in a MovieClip with an instance name of 'source1'. Once I get it working, I will convert to my own class, so any help in these directions would be gratfully appreciated.

      Attach Code

      import flash.display.*;
      import flash.geom.*;
      import mx.transitions.Tween;
      import mx.transitions.easing.*;
      function main():Void {
      function init():Void {
      // 'source1' is a movieclip placed on stage, 400 x 300
      sourceWidth = source1._width;
      sourceHeight = source1._height;
      sqSize = 100;
      divX = sourceWidth/sqSize;
      divY = sourceWidth/sqSize;
      function setUpCopy():Void {
      bmd = new BitmapData(sourceWidth, sourceHeight, false, 0x000000);
      for (var i = 0; i<4; i++) {
      var xPos = 100*i;
      var yPos = 0;
      var temp:MovieClip = this.createEmptyMovieClip("rect"+i, this.getNextHighestDepth());
      temp._x = sourceWidth+xPos;
      temp._y = yPos;
      var tempBMD = new BitmapData(sqSize, sqSize, false, 0x99CCFF);
      tempBMD.copyPixels(bmd, new Rectangle(xPos, yPos, sqSize, sqSize), new Point(xPos, yPos));
      temp.attachBitmap(tempBMD, i+100); // why does it only do the first one????
      function tweenClip() {
      for (var i = 0; i<4; i++) {
      new Tween(this["rect"+i], "_x", Strong.easeIn, this["rect"+i]._x, 900, 2, true);