GoodMorning, I have a question about of usage this parameter in contructor class.
My minimal code is:
import processing.video.*;
class MediaLoad {
File file;
Movie mov;
MediaLoad (File _file) {
_file = file;
mov = new Movie(this,file.getAbsolutePath());
}
}
MediaLoad ml;
when I digit the line: mov = new Movie(this,file.getAbsolutePath());
the red allert compare with: The constructor “Movie(MediaLoad, String)” does not exist
In the Object documentation is explained the this parameter is parent and the error confirm that.
Is a way to instantiate my mov variable inside another class?
import processing.video.*;
class MediaLoad {
ArrayList<File> mediaList = new ArrayList<File>();
ArrayList<File> fileArray; // array con i file dell'articolo selezionato
ArrayList<Movie> videoList; // array con i video caricati
MediaLoad(ArrayList<File> _mediaList) {
mediaList = _mediaList;
}
void load() {
boolean videoTrovato = false;
fileArray = new ArrayList<File>();
for (File file : mediaList) {
if (!file.getName().contains(".thum") && !file.isDirectory()) {
if ( // carico i video in array
file.getName().contains(".mov")
|| file.getName().contains(".mp4")
|| file.getName().contains(".avi")) {
videoTrovato = true;
fileArray.add(file);
} // fine if
} // fine if non thumb
} // fine for mediaList
if (videoTrovato) {
loadMovie(fileArray, videoList);
} // fine if videoTrovato
} // fine load;
} // fine class
// -------------------------------------------------------------------------
void loadMovie(ArrayList<File> fileList, ArrayList<Movie> movList) {
for (File file : fileList) {
movList.add(new Movie(this, file.getAbsolutePath()));
}
}
the code is only an extract of my MediaLoad class
Have a Nice Coding Guys !!!