Who is opening that dialog box ? Whoever send the request gets the response.
If your browser open a dialog box, it means it was the sender of the
request. If the Flash movie sends the request, it should get the response
and there should not be any dialog box.

You are doing right in your servlet : just set the content type, get the
PrintWriter form the response and print to it.

Her is a very simple example of a counter :

import java.io.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;

public class Compteur extends HttpServlet {

        public void doPost(     HttpServletRequest requête,
                                                HttpServletResponse réponse)
                                                throws IOException, ServletException {
                réponse.setContentType("application-x/www-urlformencoded");
                PrintWriter pw = réponse.getWriter();
                String path = VolgaUtil.concatPaths(VolgaUtil.getDocumentRoot(this),
"/counters/");
                String compteur = requête.getParameter("page");

                if (compteur == null || compteur.equals("")) {
                        return;
                }

                // Lecture de la valeur du compteur
                Properties properties = new Properties();
                try {
                        FileInputStream fichierCompteur = new FileInputStream(path + 
compteur);
                        properties.load(fichierCompteur);
                        fichierCompteur.close();
                }
                catch (IOException ioe) {
                }
                pw.print("compteur=" + properties.getProperty("compte"));
        }

        public void doGet(      HttpServletRequest requête,
                                                HttpServletResponse réponse)
                                                throws IOException, ServletException {
                doPost(requête, réponse);
        }
}

and here is part of the ActionScript code that read from it :

        url = "http://your.domain.com/servlet/Compteur";;
        loadVariables(url, "clipname", "POST");

clipname is the name of a clip in your movie that is notified when the data
is fully loaded.

You the use the load event in the clip to do whatever you want, for example
:

onClipEvent(load) {
        _root.initAnim();
}

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
Frauke Nonnenmacher
Envoyé : jeudi 26 avril 2001 17:16
À : [EMAIL PROTECTED]
Objet : Re: Servlet communication with embedded applications (FLASH etc)


> 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".

Thanks, that's just what I need. Just one more question: After setting the
type to "application-x/www-urlformencoded", how do I write the data? I tried
to get the PrintWriter from the response and just println to that, which
didn't work (Well, I didn't have high hopes that it would). Here's the code
snippet:

    PrintWriter out = response.getWriter();
    out.println("Surname=Smith");

I'm just trying to send a variable called Surname with the value Smith back
to Flash, and I don't know if it's the method or the syntax that's wrong...
What I'm getting is a dialogue box asking me if I want to open the file
'LoginServlet' or save it to disk.

I tried searching the archives of the list, but the search engine seem to be
down...

Thanks for your help,

Frauke

Frauke Nonnenmacher
Fat Cat Cartoons
www.fatcatoons.com <http://www.fatcatoons.com>
___________________________________________________
The statements and opinions expressed here are my own
and do not necessarily represent those of the VEGA Group.

___________________________________________________________________________
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

Reply via email to