Quantcast
Channel: Library Questions - Processing 2.x and 3.x Forum
Viewing all articles
Browse latest Browse all 2896

Problem using Video in Objects/class

$
0
0

Hello, I am trying to use video inside an object. This code worked fine before I started building the class - I think my problem is that I don't know where to place the initialisation of the movie. Below is my code and I am getting an error on line 43. The error says " The constructor "Movie(Tile,String)" does not exist". Eventually i would like to have a number of tile objects arranged in a certain pattern and when the cursor moves over each tile it plays the movie file and plays a separate sample.

Thanks for the help (code below)

    import processing.video.*;
    import ddf.minim.*;
    Movie movie1;
    Minim minim;
    AudioSample sample;

    Tile t1;

    void setup() {
    fullScreen(2);

    }


     void draw() {

    background(155);
    t1.presentTile(400,500);


 }

 class Tile {


    int boxSize;
    boolean overBox = false;
    boolean canTrigger = true;
    float boxMax = 100;
    float boxMin = 25;

    void movieEvent(Movie movie1) {
    movie1.read();
    }

Tile() {


    imageMode(CENTER);
    boxSize = 25;

    minim = new Minim(this);
    movie1 = new Movie(this,"TORCH_2_1.mov");
    movie1.loop();
    movie1.pause();
    sample = minim.loadSample("Paper Rustle_1.mp3");

    t1 = new Tile();



}



void presentTile(float bx,float by) {

    if (mouseX > bx-(boxSize/2) && mouseX < bx+(boxSize/2) &&
    mouseY > by-(boxSize/2) && mouseY < by+(boxSize/2)) {
    overBox = true;

    } else {

    overBox = false;
    }

    if ((overBox) && (boxSize < boxMax)) {

    image(movie1, bx, by,boxSize++,boxSize++);
    movie1.loop();

    }
    if ((!overBox)&&(boxSize > boxMin)){

    image(movie1, bx, by,boxSize-=3,boxSize-=3);
    movie1.pause();

    }
    image(movie1,bx,by,boxSize,boxSize);

    if (canTrigger && overBox) {
    sample.trigger();
    canTrigger = false;

    }

    if (!overBox) {
    sample.stop();
    canTrigger = true;
    }

}

}

Viewing all articles
Browse latest Browse all 2896

Trending Articles