Home Tutorials Forums Articles Blogs Movies Library Employment Press Buy templates

Go Back   ActionScript.org Forums > Supporting Technologies > Server-Side Scripting

Reply
 
Thread Tools Rate Thread Display Modes
Old 01-08-2001, 08:50 PM   #1
Miranda
Registered User
 
Join Date: Jan 2001
Posts: 2
Unhappy

I am having a lot of problems getting the data back from a JSP after submitting the data from the Flash movie to it.

I currently have a small 2 frame test example like so:

Frame 1:

Action: stop();
Text box: login
Button: done

Action for done:
on(release, keyPress"<Enter>") {
loadVariables("http://localhost:8100/test/logintest.jsp", "_root.logincatcher", "POST");
}

Movieclip: logincatcher

Action for logincatcher:
onClipEvent(data) {
gotoAndPlay(2);
}

Frame 2:
Action: stop();
Text box: return

The JSP is very simple:
<%
String login = request.getParameter("login");
out.println("return=" + login);
%>

I have been through many different incarnations of these two files. At one point, it *was* submitting to the JSP perfectly fine, the login variable was received, but whatever I was doing with loadVariables was not reading the data back into the movie...in fact I would never even get back to the movie, my logintest.jsp page would load in the browser with the return=foo text on that page.

This current incarnation just sits in Frame 1 and never goes any further. I am expecting that once the data is received from the JSP, then in Frame 2, the return variable will be displayed. Even though the movie *seems* to be stuck in Frame 1, it is attempting to do the processing on the JSP because the compiled Java files are being generated by JRun (my JSP environment).

Does anyone have any ideas on what is wrong with my Flash? I am assuming that is where the error is since my knowledge of Flash is pretty limited.

Thanks!
Miranda
Miranda is offline   Reply With Quote
Old 01-09-2001, 01:57 AM   #2
Jesse
Administrator
 
Jesse's Avatar
 
Join Date: Nov 2000
Location: Australia
Posts: 8,612
Default

(I know nothing about JSP)
As far as I know Flash can't accept returned values from an external scripting agent like PHP or JSP. I've never seen it done. I tend to circumvent this by exporting my variables to data files on the server and loading them in that way (from the data files). Something like me Count Tutorial shows how I do this.

I hope this helps.

Cheers

Jesse
__________________
Cheers

Jesse Stratford
ActionScript.org Cofounder
Email: presented in this way to stop spam-bots: My email is composed of my first name (jesse) followed by my last name (stratford) followed by @ followed by actionscript.org

Please don't email or PM me Flash questions, that's what the Forums are for!

Please don't rely on me reading my PMs either. Email me about important stuff.
Jesse is offline   Reply With Quote
Old 01-09-2001, 03:18 AM   #3
Miranda
Registered User
 
Join Date: Jan 2001
Posts: 2
Default

Thanks...I had already tried changing my way of doing it and trying to model it after the looping method in the counter example.

The reason that I was writing directly back from the JSP was that all the other tutorials I have read say that you can do this with ASP...JSP is very similar, except the language is Java not VB.

I have reached limited success by writing a text file with the JSP and then reading back from that text file in the movie. Unfortunately, I seem to be having some serious caching issues, because the movie is keeping the first value it receives until the cache is cleared and the text file is manually deleted (even when the text file contains a new value).

There's not much reason why it should read semi-fine from the text file, but not wait to read back from the JSP, since the JSP is just writing text back to the response stream.

I figured that in theory, even if the flash movie cannot read variables directly from the JSP, it should just wait forever because finish will never be true if it does not get that from the JSP. The movie moves through frame 2 so fast that I never even see the "Processing..." text, even briefly, however.

The JSP is generating: logintest=foo&finish=true

Frame 1:
Text box: login
Button: done

Actions for frame 1:
start = "false";
finish = "false";
stop();

Frame 2:
Static text box: "Processing..."

Actions for frame 2:
if (start == "false") {
start = "true";
loadVariables("logintest.jsp", 0, "POST");
}

if (finish=="true") {
gotoAndPlay(3);
} else {
gotoAndPlay(2);
}

Frame 3:
Static text box: "Logintest is"
Text box: logintest

Actions for frame 3:
stop();

Miranda is offline   Reply With Quote
Old 01-14-2001, 10:08 AM   #4
neeld
Registered User
 
Join Date: Jan 2001
Posts: 2
Default

Yes, Flash can read variables from asp,jsp,php, whatever. All you need to do is write them out as Miranda I doing.

The only thing I would change is adding an ampersand to the start and finish. Flash reads a trailing space as part of the value of the last variable. So the value might be read as "login " insted of "login". The trailing ampersand will fix that.

<%
String login = request.getParameter("login");
out.println("&return=" + login + "&");
%>

Also, if your using flash 4, consider loading your variables into a movieClip. Using kinda like a folder analogy. It can make it simpler to remember where they are when you start getting lots of them flying around.

When you use GET or POST, all variables that exist in the timeline you called it from get sent. You can be more specific by manually coding your GET.

loadVariables("logintest.jsp?login=" + login);

If your using Flash 5, look into the XML, its fantastic.

Neeld
neeld is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

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 Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
one template, many looks? subquark ActionScript 1.0 (and below) 1161 09-03-2009 04:45 PM
plz check out my flash 8 movie, I got a small problem with it... maxnb ActionScript 2.0 8 02-09-2006 12:53 PM
Passing Variable thebutterfly ActionScript 2.0 72 01-24-2006 04:12 PM
Loading images in different frames.. nchagial ActionScript 2.0 22 12-21-2005 09:06 AM
Flash MX seminar Tink ActionScript 1.0 (and below) 5 03-17-2002 05:41 AM


All times are GMT. The time now is 11:12 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2009 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.