4 Replies Latest reply on Sep 7, 2011 10:31 AM by gotoAndHelp ( please )

    Creating puzzle pieces help

    name change july15th Level 1


      I'm trying to created iregular puzzle pieces from a picture(in flash cs5.5) can anyone sugest some ways of doing this?maybe a usefull link.I know how to make rectangular shapes,but i'm looking in creating iregular pieces.

      tks in advance

      this is how my make puzzle pieces function looks like

      the shapes are rectangular

              private function makePuzzlePieces(bitmapData:BitmapData)
                  puzzleObjects = new Array();
                  for (var x:uint = 0; x < numPiecesHoriz; x++)
                      for (var y:uint = 0; y< numPiecesVert; y ++)
                          //create new puzzle piece and sprite
                          var newPuzzlePieceBitmap:Bitmap = new Bitmap(new BitmapData(pieceWidth,pieceHeight));
                          newPuzzlePieceBitmap.bitmapData.copyPixels(bitmapData,new Rectangle(x*pieceWidth,y*pieceHeight,pieceWidth,pieceHeight),new Point(0,0));
                          var newPuzzlePiece:Sprite = new Sprite();


                          //place in bottom sprite;
                          //create object to store in array;
                          var newPuzzleObject:Object = new Object();
                          newPuzzleObject.loc = new Point(x,y);// location in puzzle
                          newPuzzleObject.dragOffset = null;//offset from cursor
                          newPuzzleObject.piece = new PuzzlePiece  ;
                          newPuzzlePiece.addEventListener(MouseEvent.MOUSE_DOWN, clickPuzzlePiece);
                  //randomize location of puzzle pieces