aspose file tools*
The moose likes Applets and the fly likes Flash Movie in Java Applet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Applets
Bookmark "Flash Movie in Java Applet" Watch "Flash Movie in Java Applet" New topic
Author

Flash Movie in Java Applet

Ast Lavond
Greenhorn

Joined: Mar 02, 2010
Posts: 16
Hello Forum,

is it possible to embed a Flash Movie (swf) in a Java Applet?
I searched for any solutions, but I couldn't find anything previously.

Even with JFlashPlayer (that allows to integrate Flash movies into Java applications)
it does not seem to work:

Can JFlashPlayer work in a java applet?
No, for several reasons including browser security and the way applets load in browsers,
JFlashPlayer cannot work properly in an applet.


JFlashPlayer


Or possibly with a html container or something like that?

kind regards
lavond
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42913
    
  68
What is the benefit of playing a Flash movies in an applet instead of an IFrame or in some other HTML-based way?
Ast Lavond
Greenhorn

Joined: Mar 02, 2010
Posts: 16
The Java applet already exists, so I can't use other technologies such as html or use JSPs.
The Applet contains a form. If the form fields are not completed, it will be displayed in a Flash movie.

It's important to communicate from Java with the ActionsScript Methodes in the Flash movie. -> That is no problem with JavaScript.
But is it possible to implement html-code in a Applet?
So I could integrate the Flash movie in html and use JavaScript to control the communication between Java and ActionScript.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42913
    
  68
Not sure what you mean by "implement html-code in a Applet", but it's possible to call JavaScript from within an applet, which could in turn call ActionScript in the Flash movie. This is called "LiveConnect", and the AppletsFaq has more detail on that.

Overall, a GUI that employs both Flash and applets seems ill-conceived to me, and it's probably confusing to the user. Why not do it all in the applet, or all within Flash/Flex?
Ast Lavond
Greenhorn

Joined: Mar 02, 2010
Posts: 16
Thanks for the fast reply!

By "implement html code in a applet" I believe that the flash movie is embedded in HTML (html and flash) and is placed (for example in an HTML container) to the applet.

You have absolutely right, I would also prefer to do everything in Flash / Flex, but for this project I need to use the applet.

Sorry for my bad english ;)
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42913
    
  68
By "implement html code in a applet" I believe that the flash movie is embedded in HTML (html and flash) and is placed (for example in an HTML container) to the applet.

Flash is generally embedded in HTML, but the "is placed to the applet" part is unclear - do you mean the Flash movie is located visually next to the applet? Both applet ans Flash content would be part of the same HTML page.

Would the approach I outlined in my previous post work?
Ast Lavond
Greenhorn

Joined: Mar 02, 2010
Posts: 16
Flash is generally embedded in HTML, but the "is placed to the applet" part is unclear - do you mean the Flash movie is located visually next to the applet?

No. The Java applet containing Swing components, and I mean that it may be possible to use a Swing component in order to integrate the Flash movie in the Applet (like the JFlashPlayer object for a Java Application -> in my first post).
Maybe you can also use a Swing component that supports html to embed the Flash movie as <object> tag in html code (like the WebBrowser object in this example: embedding a web browser in java).

Both applet ans Flash content would be part of the same HTML page.

The Flash movie can not be placed next to the applet and in my opinion to put the Flash movie in a layer over the applet is very ugly.

Would the approach I outlined in my previous post work?

You mean "LiveConnect" with JavaScript?
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42913
    
  68
it may be possible to use a Swing component in order to integrate the Flash movie in the Applet (like the JFlashPlayer object for a Java Application -> in my first post).

JMF supports playback of Flash version 2 files, and it's pure Java. If installing other software, and possibly signing the applet, is acceptable, then Quicktime4Java and the Java Media Components may be workable options; see the OtherOpenSourceProjectsFaq for links about these.

Maybe you can also use a Swing component that supports html to embed the Flash movie as <object> tag in html code
.
I'm almost certain that no Java web component in existence supports the OBJECT tag, unless you're considering components that embed an actual browser.

The Flash movie can not be placed next to the applet

Is that a functional requirement? It's obviously possible technically.

You mean "LiveConnect" with JavaScript?

Yes.
Ast Lavond
Greenhorn

Joined: Mar 02, 2010
Posts: 16
Is that a functional requirement? It's obviously possible technically.

Yes, it's a functional requirement.

You mean "LiveConnect" with JavaScript?
Yes.


So far I have not tried the LiveConnect with JavaScript.

JMF supports playback of Flash version 2 files

Do you mean SWF files, which were created with Flash CS2?


It is not so easy to integrate a Flash movie in an applet.
Thanks for your help!
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42913
    
  68
Ast Lavond wrote:
JMF supports playback of Flash version 2 files

Do you mean SWF files, which were created with Flash CS2?

I don't actually know, that's just what the JMF documentation says. But I'm pretty sure it refers to a file format version, not to an application version.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Flash Movie in Java Applet