Hi,
First, remember Java Applets is a much better technology for client side
development.
That said, why would you use a JSP page for this ? JSP is supposed to help
you mix generated data with HTML code. Here you only need to send data,
don't you ? (unless you want to send the flash application and the data in
one shot, like in case 1 below). Anyway, here is hwo you can proceed (copy
of a old post you might have found in the archive ;-) :
You can send data from a servlet to a Flash movie using 4 methods :
1) Passing data as parmaters in the html form containing the link to the
flash movie. Data has to be in url-encoded format (although Flash is very
loosy on this format and will accept any character, even returns and
linefeeds. You can take advantage of this, but it can also leads to
problems.) Here is an example of parameters send to a Falsh movie
representing an invoice. Data is extracted from a database by the servlet :
<HTML><HEAD><TITLE>Facture</TITLE></HEAD><BODY bgcolor='#FFFFFF'><OBJECT
classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000'
codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.ca
b#version=5,0,0,0' WIDTH='558' HEIGHT='805'> <PARAM NAME='movie'
VALUE='../images/Facture.swf?num�roFacture=980-10-901255&adresse=Mr Martin
3 place Vendome
75000 PARIS&date=2001-04-25&commande=Fax&num�roCommande=988209413235 ... '>
<PARAM NAME=quality VALUE=high>
<PARAM NAME=bgcolor VALUE=#FFFFFF>
<EMBED src='Facture.swf?num�roFacture=980-10-901255&adresse=Mr Martin
3 place Vendome
75000 PARIS&date=2001-04-25&commande=Fax&num�roCommande=988209413235 ... '
quality=high bgcolor=#FFFFFF WIDTH=558 HEIGHT=805
TYPE='application/x-shockwave-flash'
PLUGINSPAGE='http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_
Version=ShockwaveFlash'></EMBED></OBJECT></BODY></HTML>
Do not forget that you have to put the parameters twice (once for IE an once
for Netscape).
The only problem with this approach is that the data is visible in the
source of the page. The data type is simply text/html.
2) You can use loadVariables in ActionScript to load data from a URL in the
domain the movie came from. This URL might be a servlet. It might send data
in url encoded form. This servlet (the one that sends the data) must use
content type "application-x/www-urlformencoded".
3) You can use XML.load or XML.sendAndLoad in ActionScript to load XML data
from a URL in the domain where the movie originated. It might also be a
servlet and content-type must be text/plain. Beware that ActionScript is not
XML compliant so there are many problems with this approach. (I already
described some in a former thread - in short, leading and trailing spaces
are considered separate text elements.)
For method 2 and 3, beware of a bug : wether you call for post or get, you
will get post (ie, the doPost method will be called !)
4) You can use XMLSocket to communicate with whatever you want wherever you
want.
If your data is flat (name/value pairs) the easiest way is probably n� 2
Pierre-Yves
-----Message d'origine-----
De : A mailing list for discussion about Sun Microsystem's Java Servlet
API Technology. [mailto:[EMAIL PROTECTED]]De la part de
karthikeyan
Envoy� : lundi 9 juillet 2001 16:50
� : [EMAIL PROTECTED]
Objet : jsp communication with flash
Hi all,
I have a Flash Movie Templates (.swt) file containing variable elements
(text)
that has to be replaced with content by the server, in this case JSP. Such
generated content needs to be played back to the client's browser as
Shockwave
Flash.
I went to macromedia site, they did had a white paper on how to accomplish
this task using JSP.
I need someone who had worked on it so that i could take their help to
accomplish my task.
this is Urgent
With Regards,
b.karthikeyan.
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html