JSwiff
flash movies the java way
JSwiff Forum
  Search   Recent Topics     Member Listing    Back to home page 
Register / 
Login 
How to trigger an action in swf file from Java server side  
Forum Index -> How Do I...
Author Message
syamc


Joined: Jan 18, 2008
Messages: 1
Offline

Hi,

I am new to SWF/Flash and appreciate if someone can point me in right direction.

I have a swf file that's created using Crystal tool. When the swf file is loaded in browser, an action submits a url request to get an xml data file. The xml data is then used to complete the display.

I am able to read and swf in memory and write to Servlet outputStream. Now, I would like to know if it feasible to trigger the action on server side itself.

- Pass parameters to the swf file
- trigger action(s) to submit url request and consume xml data.

Here is the code snippet of what I have so far:

File swfFile = new File(request.getSession().getServletContext().getRealPath(DEFAULT_SWF_FILE_URL));
response.setContentType(request.getSession().getServletContext().getMimeType(DEFAULT_SWF_FILE_URL));
response.setContentLength((int)swfFile.length());

FileInputStream swfFileStream = new FileInputStream(swfFile);
SWFReader swfReader = new SWFReader(swfFileStream);
SWFDocumentReader docReader = new SWFDocumentReader();
swfReader.addListener(docReader);

swfReader.read();
SWFDocument swfDoc = docReader.getDocument();
OutputStream outputStream = response.getOutputStream();
SWFWriter writer = new SWFWriter(swfDoc, outputStream);
writer.write();

Thanks in advance!
 
  Forum Index -> How Do I...
Go to:   
Legal notes
Powered by JForum 2.1.4 © 2005 - Rafael Steil