PDA

View Full Version : LoadVars problem


Kassiopeia
11-15-2006, 03:07 PM
Hi,

I'm using jsp to pass 2 ids to flash, and from there I use those 2 ids to select some fields in a db through a web service. He passes the right ids, but in the browser he never goes to frame 2, and he doesn't load anything from database.


var test= new LoadVars();

test.onLoad = function() {
for (vtest in this) {
data = this["id_1"]+"<;>"+this["id_2"];
}
Ws.params = [data];
Ws.trigger();
_global.resultsWs = new Array();
var WsListener:Object = new Object();
WsListener.result = function(evt:Object) {
_global.resultsWs = evt.target.results.split("<;>");
for (i=0; i<_global.resultsWs .length; i++) {
_global.props = _global.resultsWs[i].split("<,>");
}
gotoAndPlay(2);
};
Ws.addEventListener("result", WsListener);
};
test.load("http://localhost:2159/page.jsp");
stop();


Why doesn't he passes to frame 2 and doesn't load any data from the db?

tg
11-15-2006, 04:12 PM
likely a pathing problem... with no formating in the code, i have a hard time seeing the nesting. heh.

put in the object reference for the object you want to move tho frame 2. ie. myMovie.gotoAndPlay(2); or _root.gotoAndPlay(2);.... specify your target (with the path), otherwise flash uses the current scope as the target and in the posted case that would be your loadvars object.

Kassiopeia
11-15-2006, 05:49 PM
I tried chaging the path, but is the same thing.

I tried using a *.txt file. I ran it inside flash and everything worked fine, I tried use it in a browser, also with the *.txt, and it doesn't load anything, and it doesn't go to frame 2. So the problem must be using the flash movie in a browser. I tried in ie and firefox, and it's the same problem for both...

Cota
11-15-2006, 06:31 PM
On the server, what id ("http://localhost:2159/page.jsp"); changed to? Is the jsp file in the same domain?

Kassiopeia
11-15-2006, 08:58 PM
On the server, what id ("http://localhost:2159/page.jsp"); changed to?


I don't understand your question. But yes, everything is in the same domain.

tg
11-15-2006, 09:30 PM
so is the path to your jsp page correct? it is sitting on the root directory of your server?

add this to your flash file:

test.send("http://localhost:2159/page.jsp","_blank","POST");


what this will do is send a request to your jsp page, and pop the results of the page up into a browser window... so if there is an error in the jsp, you will see it displayed in the browser.

Cota
11-15-2006, 09:38 PM
On the server, try

test.send("page.jsp",test,"POST");

Kassiopeia
11-15-2006, 09:58 PM
Ok, I've tried and returns no error. Only the string with the ids:

id_1=1&id_2=1

I have the flash loading the data from db through a web service, and that seems to be the problem, he doesn't connect to the web service.

But inside flash everything works great...

tg
11-15-2006, 10:04 PM
for connecting to a web service you may need to use flash remoting, not loadvars... thats how i do it at least, but it may not necessarily be the only way.

Kassiopeia
11-16-2006, 11:53 AM
I searched and I didn't found anything about, but i'll try to do it another way.

Thanks.

tg
11-16-2006, 10:28 PM
yeah. i know nothing about remoting with jsp.... i use cf sorry i cant help you.