We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hi guys. I have a trouble on my code. I want to make a 80x45 pixels mov into 640x360 pixels display. But, it has a error on row 22. Help me~~~~
import processing.video.*;
int cell;
int col, row;
Movie m;
void setup() {
size(640, 360); // 8 times mov
m = new Movie(this, "m_80_45.mov"); //mov size is 80x45 pixels
cell = 8;
col = width/cell;
row = height/cell;
}
void draw() {
if (m.available()) {
m.read();
}
m.loadPixels();
for (int i=0; i<col; i++) {
for (int j=0; j<row; j++) {
int loc = i + j*m.width;
color c = m.pixels[loc]; // this row has error! say: ArrayIndexOutOfBoundsException:0
fill(c);
int x = i*cell;
int y = j*cell;
rect(x, y, cell, cell);
}
}
}
Answers
you should have the for loop within the if-clause that says
if (m.available()) {