-
Problem with LoadVars
I am having a problem using LoadVars. I have the following functions in a Flash movie.
function testForVars() {
dataSender = new LoadVars();
dataReceiver = new LoadVars();
dataSender.sendAndLoad("retTest.html",dataReceiver ,"POST");
dataReceiver.onLoad = showRetVals;
}
function showRetVals() {
trace("retval1 = "+this.retval1);
trace("retval2 = "+this.retval2);
trace("retval3 = "+this.retval3);
trace("retval4 = "+this.retval4);
trace("retval5 = "+this.retval5);
}
and the following HTML page ( - added to tags so they show)
<-HTML>
<-HEAD>
<-TITLE>Var Test<-/TITLE>
<-/HEAD>
<-BODY>
retval1=50&retval2=65&retval3=dog&retval4=785&retv al5=house
<-/BODY>
<-/HTML>
When I run the .swf the result is
retval1 =
retval2 = 65
retval3 = dog
retval4 = 785
retval5 = house
<-/BODY> (no dash in output)
<-/HTML> (no dash in output)
Does anybody have any idea how to get the first value to show and the <-/BODY> and <-/HTML> to not show in the output? I cannot see how the tags are getting into Flash.
-
why not create a separate html file that loads the flash into it?
you can still render the text as HTML, but won't need the <-html><-/html>, etc...b/c when the page is loaded into the browser, it will be there from the external html file...
-
Lifesaver
Try changing:
retval1=50&retval2=65&retval3=dog&retval4=785&retv al5=house
to:
&retval1=50&retval2=65&retval3=dog&retval4=785&ret val5=house
Hope this helps.
-
I added the &. This gives me the value for retval1. I still see the tags pulled into Flash though.
-
Lifesaver
Try putting a ; at the end of the line
-
Originally posted by iguanagirl32
why not create a separate html file that loads the flash into it?
you can still render the text as HTML, but won't need the <-html><-/html>, etc...b/c when the page is loaded into the browser, it will be there from the external html file...
I am using a Stand alone projector to run diagnostics on a database. I have no problem with pages that just verify the database is saving by returning a single error code. If I try and return multiple values I am running into this problem. The existing pages are .asp and work correctly. I am using HTML as a test page and that is how I came across this problem. The HTML is not actually a part of the Flash output, it is just being loaded by LoadVars.
-
Originally posted by Lightwave Network
Try putting a ; at the end of the line
I tried this and it just adds ; to the last value :-( It sounded promising.
-
It looks like LoadVars doesn't like working in this way with a .html page. If I save the page as an .asp page it works with no problem. Go figure.
-
It looks like LoadVars doesn't like working in this way with a .html page. If I save the page as an .asp page it works with no problem. Go figure.
-
Lifesaver
-
I wonder if this is a known bug in Flash
-
Well, it's a fix...
I've never used sendAndLoad like you are here, so I dl'ed your code, and ran it, and I got the same problem. I spent about 5 minutes trying to pull something like this:
PHP Code:
retval5 = retVal.substr(0, retval5.indexOf("\r"));
but I got nothing. I finally just cut it off the same way you made your first variable appear... I appended a "&" after the last variable in the html code, which tells flash that thats the end of retval5. the tag garbage still gets loaded I think, it just doesn't get assigned to anything valuable... hope this helps...
grins,
-J
-
Luckily I am going to be using .asp anyway, so it is not a big deal. I would have thought that it would have worked the same in .html.
OH WELL!!!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|