interactive .swf in java application.

E

eeyimaya

Hello,

I want to play my .swf interactive movies in my java application. But
succeeded only in playing noninteractive movies. I searched the web,
newsgroups.... but could not find the right solution. My configuration
is WİndowXP, QuickTime 6.4, jdk1.4.1.....
I tried the code below:

HOW CAN I PLAY INTERACTIVE .SWF IN JAVA WITH QUICKTIME?????

IT IS VERY IMPORTANT AND URGENT PLEASE......


Sorry for the long message.......
THANKS A LOT......

import java.io.IOException;
import java.io.FileNotFoundException;
import quicktime.app.QTFactory;
import quicktime.app.anim.Compositor;
import quicktime.app.image.GraphicsImporterDrawer;
import quicktime.app.image.ImagePresenter;
import quicktime.app.image.ImageUtil;
import quicktime.app.players.MoviePresenter;
import quicktime.io.QTFile;
import quicktime.io_OpenMovieFile;
import quicktime.qd.QDRect;
import quicktime.qd.QDGraphics;
import quicktime.qd.QDColor;
import quicktime.qd.QDConstants;
import quicktime.std.StdQTConstants;
import quicktime.std.movies.Movie;
import quicktime.std.movies.media.FlashMedia;
import quicktime.QTSession;
import quicktime.QTException;

/**
* QTZoo Module 2 - Playing a movie
*
* @author Michael Hopkins
* @author Levi Brown
* @author Apple Computer, Inc.
* @version 1.0.1 11/15/1999
*
* Copyright: © Copyright 1999 Apple Computer, Inc. All rights
reserved.
*/
public class AnimalPane
{
public AnimalPane()
{
QDRect size = new QDRect(Zoo2.WIDTH, Zoo2.HEIGHT);

try
{
QDGraphics gw = new QDGraphics( size ); // create a new graphics
object
compositor = new Compositor( gw, QDColor.white, 30, 1 );
QTFile imageFile = new QTFile( QTFactory.findAbsolutePath(
"data/zebra/ZebraBackground.jpg" ));
GraphicsImporterDrawer drawer = new GraphicsImporterDrawer(
imageFile );
ImagePresenter presenter =
ImagePresenter.fromGraphicsImporterDrawer( drawer );
presenter.setLocation( 110, 110 ); // set location of movie
within compositor
compositor.addMember( presenter, 2 ); // add image presenter to
compositor in 2nd layer
Movie m = makeMovie( new QTFile(
QTFactory.findAbsolutePath( "data/zebra/ships.mov")));
md = new MoviePresenter( m ); // create presenter from movie
file
compositor.addMember( md, 1 ); // add presenter to compositor
compositor.getTimer().setRate(1); // start compositor
md.setRate(1); // start movie
}
catch ( IOException e ) // catch any errors
{
e.printStackTrace();
}
catch ( QTException e )
{
e.printStackTrace();
}
}

public Compositor getCompositor( ) { return compositor; } // returns
the compositor associated with the animal pane
/**
* Opens the movie file and sets it up to be played.
* @param f a QTFile representing the movie to initialize.
* @return the movie, ready to play
*/
protected Movie makeMovie( QTFile f ) throws IOException, QTException
{
OpenMovieFile movieFile = OpenMovieFile.asRead(f);
Movie m = Movie.fromFile( movieFile );

//m.getTimeBase().setFlags( StdQTConstants.loopTimeBase );// we want
the movie to loop
m.getTimeBase().setFlags( StdQTConstants.mcInfoMovieIsInteractive);
return m;
}

protected Compositor compositor;
protected MoviePresenter md;
}


************************************************
import java.awt.*;
import java.awt.event.*;
import java.io.IOException;

import quicktime.QTSession;
import quicktime.QTException;

import quicktime.app.display.QTCanvas;


/**
* QTZoo Module 2 - Playing a Movie
* This application requires QuickTime for Java
*
* @author Michael Hopkins
* @author Levi Brown
* @author Apple Computer, Inc.
* @version 1.0.2 10/21/1999
*
* Copyright: © Copyright 1999 Apple Computer, Inc. All rights
reserved.
*
*/

public class Zoo2 extends Frame
{
static public int WIDTH = 800;
static public int HEIGHT = 600;

public Zoo2( String s )
{
super(s);
setResizable( false ); // we don't want the window to resize
setBounds( 0, 0, WIDTH, HEIGHT ); // make window 640x480
QTCanvas myQTCanvas = new QTCanvas( QTCanvas.kInitialSize, 0.5F,
0.5F );
add( myQTCanvas );
AnimalPane zebraPane = new AnimalPane(); // load media
try
{
myQTCanvas.setClient( zebraPane.getCompositor(), true );
}
catch ( QTException e )
{
e.printStackTrace();
}
addWindowListener( new WindowAdapter() // anonymous inner class
for handling window events
{
public void windowClosing( WindowEvent we )
{
QTSession.close(); // shut down QT and clean up
dispose(); // destroy window
}
public void windowClosed( WindowEvent we )
{
System.exit( 0 ); // exit to shell
}
});
}

/**
* Main entry point for the application
*/
public static void main( String[] args )
{
try
{
QTSession.open(); // perform native QuickTime initialization
Zoo2 appWindow = new Zoo2( "QTZoo2" ); // create a new application
window
appWindow.show(); // make the window visible
appWindow.toFront(); // bring it to the front
}
catch ( Exception e ) // handle any exceptions
{
QTSession.close();
e.printStackTrace();
}
}
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top