Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > interactive .swf in java application.

Reply
Thread Tools

interactive .swf in java application.

 
 
eeyimaya
Guest
Posts: n/a
 
      10-22-2003
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();
}
}
}
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
running interactive 4NT commands from java nanda Java 0 07-18-2006 09:37 PM
Are there any interactive command line interpreters for java? Charles Fox Java 3 04-15-2005 11:14 AM
Interactive/Non-interactive ASPX ? WJ ASP .Net 2 02-26-2005 02:54 AM
non Interactive and Interactive AAH Computer Support 0 01-09-2005 04:09 PM
Interactive and non interactive AAH Computer Support 1 01-09-2005 04:01 PM



Advertisments