Salve a tutti,
dentro alla mia libreria ho
ho un'immagine e un movie clip.
Dentro al movie clip ho una piccola box.

Riesco a creare 20 box a partire da quella piccola, tramite il codice
for (var py:int = 0; py<rows; py++) {
for (var px:int = 0; px<cols; px++) {

var box:Box = new Box();
box.x = 50 + box.width * px;
box.y = 50 + box.height * py;
addChild(box);

box.alpha = .5;
}
}
in questo modo mi crea 20 box dello stesso colore del box dentro alla libreria, grigio.

Vorrei poter copiare l'immagine che si trova dentro alla libraria, divisa in base al numero dei blocchi.
E' possibile copiare l'immagine dentro ad una variabile temp e dividere questa immagine?

Non ho idea.
Posto l'intero codice di poche righe.
Grazie in anticipo.
import flash.display.Bitmap;
import flash.display.BitmapData;
import flash.geom.Rectangle;
import flash.geom.Point;

var boxNum:int = 20;
// we need to know how many columns our
// grid is going to have
var cols:int = 6;
// calculate how many rows we need based on
// boxNum
var rows:int = Math.ceil(boxNum / cols);
// the number of boxes attached to the stage
var boxCount:int = 0;

///////////

var xBilledet:Number = 0;
var yBilledet:Number = 0;
var placeringX:Number = 100;
var placeringY:Number = 50;
//var imageLoader:Loader = new Loader();
//var imageRequest:URLRequest = new URLRequest("myPic2.jpg");
var bitmap:BitmapData = new BitmapData(424, 600, true, 0);

///////////

for (var py:int = 0; py<rows; py++) {
for (var px:int = 0; px<cols; px++) {

var box:Box = new Box();
box.x = 50 + box.width * px;
box.y = 50 + box.height * py;

/////
//what's wrong?
var copy:BitmapData = new BitmapData(box.x,box.y,true,0);
var rect:Rectangle = new Rectangle(0,0,box.x,box.y);
var pt:Point = new Point(0,0);
box:Bitmap = new Bitmap(copy);
///end what's wrong

addChild(box);


// only add listeners if box should be active
if (boxCount < boxNum) {
box.buttonMode = true;

box.addEventListener(MouseEvent.ROLL_OVER, onOver, false, 0, true);
box.addEventListener(MouseEvent.ROLL_OUT, onOut, false, 0, true);
box.alpha = 0.5;
}else{
// box is inactive
box.alpha = .5;
}

boxCount++;
}
}

function onOver(evt:Event):void {
var box:MovieClip = MovieClip(evt.target);
addChild(box)
box.scaleX = box.scaleY = 1.3;
}

function onOut(evt:Event):void {
evt.target.scaleX = evt.target.scaleY = 1;
}