This site requires JavaScript, please enable it in your browser!
Greenfoot back
alexanderyoyo
alexanderyoyo wrote ...

2012/5/28

Integration of Videos into a Greenfoot Project

alexanderyoyo alexanderyoyo

2012/5/28

#
Hi, is it possible to integrate a, for example avi or move film into greenfoot. This movie should be an introduction, like the intro of BF3 with "DICE" and "EA". If it is possible, how can I do this.
tylers tylers

2012/5/28

#
have a look at this http://www.deitel.com/articles/java_tutorials/20060422/PlayingVideowithJMF/
davmac davmac

2012/5/28

#
Right now, it's not easy, and if you want it to work on the greenfoot.org site, it's impossible.
nccb nccb

2012/5/29

#
However -- if you can get your movie in GIF format (you'll have to have the sound separate, if at all), you can use the new importable class that can display GIFs: go to Edit->Import Class... It's the one called GIFImage
tylers tylers

2012/5/29

#
this works on the greenfoot website http://www.greenfoot.org/scenarios/5309 go onto the video class and follow the instructions!
alexanderyoyo alexanderyoyo

2012/6/13

#
I'm very sorry for the late answer, but I just wanted to thank you all, for your help :D. tylers solution works pretty well, but if the video player has finished playing the images, it should disappear, but instead of that, it starts again. I have no idea what to to, but here is the code, I'm using right now:
    public class video extends Actor
{
    int frame2 = 0;
    int frame3 = 0;
    int frame = 0;
    int frameH = 9;
    int frame2H = 100;
    int time = 0;
    String name ="video (";
    String brak = ")";
    boolean stop = false;
    /**
     * Act - do whatever the video wants to do. This method is called whenever
     * the 'Act' or 'Run' button gets pressed in the environment.
     */
    public void act() 
    {        
        
        if(!stop)
            try
            {
                frame ++;
                setImage(name+frame+brak+".jpg"); 
            }
            catch (java.lang.IllegalArgumentException iae)
            {
                stop = true;
            }
            else
            {
                Greenfoot.stop();
        }
        if(Greenfoot.isKeyDown("space"))
        {
            if(!stop)
            stop = true;
            else
            stop=false;
     
        }
        getImage().scale(1920,1080);
    }
}
tylers tylers

2012/6/13

#
i don't see anything wrong in that code. try
  • can you look at you images to see if you have got any repeated images.
  • see in the world class that you nothing resetting the int called frames.
i will edit this when i think of more answers :p beware make sure you compress your images as it will not upload onto greenfoot
You need to login to post a reply.