Assign Hit Regions in a loop
Posted: 12 Apr 2014 19:33
HI - Using this script to create 8 squares and all works well except assigning a hit region for each one - am i missing a step?
thanks!
decl i,offy,offset;
canvas_clear(c);
for(i=0;i<8;i++){
if(i<4){
offy=0;
offset=0;
}
else{
offy=150;
offset=600;
}
canvas_setStrokeStyle(c, 0.5);
canvas_setLineWidth(c, 10);
canvas_setFillStyle(c, 1);
canvas_fillRect(c, i*150-offset, offy, 150, 150);
canvas_addHitRegion(c,0,i);
canvas_setStrokeStyle(c, border);
canvas_setLineWidth(c, 10);
canvas_strokeRect(c, i*150-offset,offy , 150, 150);
canvas_setTextAlign(c, 1);
canvas_setFontSize(c,18 );
canvas_setTextBaseline(c, 1);
canvas_setFillStyle(c, {0,0,0});
canvas_fillText(c, 'Drummer'+(i+1), 75+i*150-offset, offy+75, 140);
}
thanks!
decl i,offy,offset;
canvas_clear(c);
for(i=0;i<8;i++){
if(i<4){
offy=0;
offset=0;
}
else{
offy=150;
offset=600;
}
canvas_setStrokeStyle(c, 0.5);
canvas_setLineWidth(c, 10);
canvas_setFillStyle(c, 1);
canvas_fillRect(c, i*150-offset, offy, 150, 150);
canvas_addHitRegion(c,0,i);
canvas_setStrokeStyle(c, border);
canvas_setLineWidth(c, 10);
canvas_strokeRect(c, i*150-offset,offy , 150, 150);
canvas_setTextAlign(c, 1);
canvas_setFontSize(c,18 );
canvas_setTextBaseline(c, 1);
canvas_setFillStyle(c, {0,0,0});
canvas_fillText(c, 'Drummer'+(i+1), 75+i*150-offset, offy+75, 140);
}