Olvidé poner el código:
por ahora está asi, la idea es poder extenderlo a muchos mas objetos.
CÓDIGO:
------------------------------------------------------
Código ActionScript :
import flash.events.MouseEvent;
import flash.display.Sprite;
script1.text = "H1";
script2.text = "R1";
//celdas externas
var countx:int=18;
var county:int=-1;
var counter:int=0;
var selectnum:int=NaN;
var objectac:Sprite;
while (counter<378){
if (countx<18){
var celda=new cell();
addChild(celda);
celda.x=countx* 30+150;
celda.y=county* 15;
celda.name="cx"+countx+"y"+county;
celda.addEventListener(MouseEvent.CLICK, Paste);
countx++;
counter++;
} else if (countx==18){
countx =0;
county++;
}
}
//celdas internas
var countx_int:Number=0.5;
var county_int:Number=0.5;
var counter_int:int=0;
while (counter_int<340){
if (countx_int<17.5){
var celda_int=new cell();
addChild(celda_int);
celda_int.x=(countx_int* 30)+150;
celda_int.y=(county_int* 15);
celda_int.name="cx"+countx_int+"y"+county_int;
celda_int.addEventListener(MouseEvent.CLICK, Paste);
countx_int++;
counter_int++;
} else if (countx_int==17.5){
countx_int =0.5;
county_int++;
}
}
//----------------------------------------------------------------------------------------
script1.addEventListener(MouseEvent.CLICK, selec1)
function selec1(e:MouseEvent):void{
selectnum = 1;
}
script2.addEventListener(MouseEvent.CLICK, selec2)
function selec2(e:MouseEvent):void{
selectnum = 2;
}
function Paste(e:MouseEvent):void{
if(selectnum==1){
var h = new h1();
addChild(h);
h.x = Math.floor((e.target.x)-5);
h.y = Math.floor((e.target.y)-2.5);
}else if (selectnum==2){
var ro = new r1();
addChild(r);
ro.x = Math.floor((e.target.x)-1.475);
ro.y = Math.floor((e.target.y)-12.05);
}
}
Muchas gracias de antemano.