LoadVars Problem
What am I doing wrong here? Or is this a bug I can work
around?
var mainLoadVars:LoadVars = new LoadVars();
mainLoadVars.onLoad = function()
inString = mainLoadVars.toString();
trace(inString);
btnMain.onPress = function()
mainLoadVars.load(urlcut +
"/lookup.php?func=lookupemp&empid=" + empid + "&nocache=" +
rndNoCache()); //rndNoCache() gives a random number to prevent
caching
The first time load is called, for each empid, inString comes
back correctly. The second time, load is called with an already
used empid, inString contains the latest data.
For example:
load('emp1'): returns emp1 data
load('emp2'): returns emp2 data
load('emp1'): returns emp2 data
I've tested the PHP inside a web browser and the data comes
back correctly every time.
Thanks in advance for your help.
-Craig
I've changed my code to the following, and I am having the
same issue. Tracing the success variable comes back as true every
call.
var mainLoadVars:LoadVars = new LoadVars();
var mainLoadVarsResult:LoadVars = new LoadVars();
btnMain.onPress = function()
mainLoadVars.func="lookupemp";
mainLoadVars.empid= empid;
mainLoadVars.nocache = rndNoCache();
//rndNoCache() gives a random number to prevent caching
mainLoadVars.sendAndLoad(urlcut +
"/lookup.php",mainLoadVarsResult, "POST");
mainLoadVarsResult.onLoad = function(success:Boolean)
inString = mainLoadVarsResult.toString();
trace(inString);
trace(success);
Similar Messages
-
LoadVars problem with characters
hello everyone, i am a Actionscript novice and I have a small
problem.
i am using the LoadVars class and the toString method to
retrieve some result from the web. The result obtained is
represented by the following string (which is not the full string,
as it'll be much longer to write) :
sendRPCDone%28frameElement%2C%20%22chelsea%22%2C%20new%20Array%28%22chelsea%22%2C%20%22che lsea%20fc%22%2C%20%22
The problem is: how do I convert these characters in Unicode
mode, such as %28, into ' ( ' ? Is there any special function?
thanks
Kthanks blemmo
-
I am running a very simple code, using
loadVars inside FMS, to load an ASP
script.
======================================
var lvData = new loadVars();
var lvR = new loadVars();
lvR.onLoad = function(BS) {
if(BS) trace("do something");
lvData.file = "test-2.swf"
lvData.sendAndLoad("
http://localhost/some.asp",
lvR);
=======================================
The script works fine, except within
some.asp, the value of
Request.Form("file") is "testB2Fswf".
In other words, "-" is replace by B,
and "." is replaced by F.
Is there a way around this problem?Hello :)
the datas in FMS are in UTF8... in your ASP script do you use
a UTF8
encoding ?
The name of a file must be easy with a-z 0-9 . caracters only
if you
want a good result.
EKA+ :)
David Mok a écrit :
> I am running a very simple code, using
> loadVars inside FMS, to load an ASP
> script.
>
> ======================================
> var lvData = new loadVars();
> var lvR = new loadVars();
>
> lvR.onLoad = function(BS) {
> if(BS) trace("do something");
> }
>
> lvData.file = "test-2.swf"
> lvData.sendAndLoad("
http://localhost/some.asp",
lvR);
> =======================================
>
> The script works fine, except within
> some.asp, the value of
> Request.Form("file") is "testB2Fswf".
> In other words, "-" is replace by B,
> and "." is replaced by F.
>
> Is there a way around this problem?
>
>
>
> -
Loadvars problem - wrong player's configuration?
I have a serious problem, i'm using loadvars for my flash
site, but i get always undefined value.
I tryed to check a online WORKING site, and surprise, i don't
see the dinamic text. I also re-check the site with my home pc and
it's full working...
I think it's a possible configuration problem with player, i
tryed to update and re-install.. but with no result.
sorry for my bad english.lollotek wrote:
> I have a serious problem, i'm using loadvars for my
flash site, but i get
> always undefined value.
> I tryed to check a online WORKING site, and surprise, i
don't see the dinamic
> text. I also re-check the site with my home pc and it's
full working...
> I think it's a possible configuration problem with
player, i tryed to update
> and re-install.. but with no result.
There is no any configuration in flash player. Pretty much
flash versions and
that's about it.
Could be that you place the SWF in html using
img/folder/name.swf ?
Any URL to see it ?
Best Regards
Urami
<urami>
If you want to mail me - DO NOT LAUGH AT MY ADDRESS
</urami> -
GetURL / LoadVars with POSTing values
Hi
Seems like there are lots of getURL / LoadVar problems and
this one seems bizarre to me.
I am trying to submit form entries in Flash to an external
perl script. I understand that locally Flash won't function with
getURL now, so have uploaded it to my server and tried testing it.
I tried just calling a getURL from within Flash with the
following:
wholeString = "
http://myHost.com/cgi-bin/FormMailer.pl?recipient=1&subject=NewFlashTest";
getURL(wholeString,"_self", "POST");
I know that the perl script and this format function as I've
sent the following from a form within my website:
<form method="post" action="
http://myhost.com/cgi-bin/FormMailer.pl?recipient=1&subject=NewTest">
<input type="hidden" name="recipient" value="1" />
<!--input type="hidden" name="subject" value="Webdesign
feedback form" /-->
Name: <input type="text" name="name" /><br />
Address: <input type="text" name="mail_address"
/><br />
E-mail: <input type="text" name="email" /><br />
Telephone: <input type="text" name="telephone"
/><br />
<input type="submit" />
</form>
This HTML form functioned exactly as it should. However, my
Flash script did call the function, but the perl script returned
saying that no recipient was passed to it. Yet the complete URL,
including the recipient value is contained in the address bar of
IE.
So, I tried with LoadVars instead. I tried this:
myObject = new LoadVars();
myObject.recipient = 1;
myObject.subject = "Testing of LoadVars";
myObject.name = "with LoadVars";
myObject.email = "[email protected]";
myObject.send("
http://myhost.com/cgi-bin/FormMailer.pl"
,"_self","POST" );
At the moment this is situated in a function called from an
onRelease on a button.
However, this appeared to do nothing and I receive nothing
from the perl script mailer.
Anyone have any suggestions? Thanks.When you use your form you are sending the variables
recipient and subject using both methods, GET and POST. Maybe this
is why the script works because it depends on this fact (it is not
the right thing to do though).
In your second example using LoadVars change the last line
to:
myObject.send("
http://myhost.com/cgi-bin/FormMailer.pl?recipient=1&subject=NewTest",
"_self", "POST");
This way you'll be doing the same as your form is doing.
If on the other hand it still doesn't work maybe it is due to
security restrictions. If the host you are calling for example is
myHost.com from flash the this is the same domain you need to use
for the html page that contains the flash file. Otherwise flash
will be blocked. Flash blocks itself from sending and reding data
from internet if the file is in your local machine and viceversa.
It blocks comunication too when the file is not in the same domain.
Even if the domain is the same but you write it different. For
example if you have your own server you can start you app using the
domain localhost. But if flash is calling data using 127.0.0.1 then
flash will block communication even though both ways of
communication refer to the same server. -
Problem with LoadVars and stopping/playing
I've got a flash movie set up online that isn't working
properly. The details are this: the movie has two frames, the first
being a blank loading frame meant to keep anything from being
displayed till the variables are delivered by my PHP script, and
the second being the frame with the actual movie content.
The actionscript I use on the first frame is as follows:
quote:
names = new LoadVars();
names.onLoad = function() {
gotoAndStop(2);
names.load("txt?id="+"EBfig298x"+"&"+secure);
stop();
The
"txt. . .secure bit is the location of my PHP script that
delivers the necessary variables. I know that the PHP side of
things is working because the flash program DOES load all the
variables in exactly as I want it to. The problem I am having is
that when played, the program stops indefinitely on frame 1. I have
to right-click and force the program to play before it flickers
past frame 2 (the content) and back to the loading frame, where it
then loads the variables and plays like it's supposed to.
You can play the flash movie at
http://images4u.com/thumbs_i4u.php?play=EBfig298x.swf
As I described above, it remains blank indefinitely, so you
will need to force it to play to see what I'm talking about.
I'd appreciate any help you guys can give to get the movie
playing automatically as it should.The first time flash attempts to do the loading, there
appears to be a 301 redirect from images4u.com to www.images4u.com
for the requested text data.
This then appears to sent... but then flash requests a
crossdomain.xml file from www.images4u.com and it receives none
(404 not found).
At that point I assume that the LoadVars onLoad does not
trigger.
The second time around it requests it from the
www.images4u.com domain and there is no problem - it doesn't seem
to need a crossdomain.xml permission.
So the problem is with the redirect. I don't know exactly the
solution. I would guess either make the request from flash to
www.images4u.com/etcetera or put a crossdomain.xml at your sites
root covering both www.images4u.com and images4u.com in terms of
permissions. -
Problem accessing data from LoadVars
Hello All,
I posted a similar topic a little while ago, the problem was
solved.... but I've decided to go back and rework my code because
it was a mess and I needed to simplify it. Of course, now when I
try to do a basic LoadVars(); I run into problems. I'm loading a
single variable text file, and I want to be able to access the
results outside the onLoad afterwards. The trace file inside my
onLoad event handler returns what I expect, but my trace at the end
returns an empty string (as defined in my variable declaration)
instead of the variable from my text file.
Is there a way I can access this data outside the onLoad
handler? and then return it from my loadWords function?
Thanks,
ScottieBitterMaybe this way would work ( if you don't mind declaring
"myRawWordList" on the root ).
////CODE////
var test_str:String = "";
function loadWords():String {
//var myRawWordList:String = "rabbitBiscuit";//this resets it
to: "rabbitBiscuit " evertime it's called.
//you might take it out, unless that's wat you wanted.
myWordLoader = new LoadVars();
myWordLoader.onLoad = function(success:Boolean) {
if (success) {
myRawWordList = this.myTextFileVar;
}//end if
}//end onLoad
myWordLoader.load("words.txt");
return myRawWordList;
}//end function
this.onEnterFrame = function(){
test_str = loadWords( );
if( test_str != "" and test_str != undefined ){
trace( "loadWords: " + test_str + " What's on the _root now:
" + _root.myRawWordList );
delete onEnterFrame;
}//end if
}//end function
////END CODE//// -
hello,
i have some variables sent out of flash in a LoadVars object,
later to be returned with the same values...
i have done "trace (typeof (variable));" before sending it
out, which tells me that "variable" is a Number, which it should
be.
i do it again upon Loadvars.load, and it is a string....
strange because a different variable goes out as a Number and
comes back as a Number...
does anyone have an idea why this happens?
thanks.my bad-
i think what happened is that i "re-declared" the one that
tells me it's a Number on the return page...
is this what i have to do for all incoming variables that are
NOT supposed to be strings?
or is there a way to CHANGE data type from String to Number?
thanks -
Flash LoadVars textfile problem
I'm using a loadvars action to load external .txt file, and
it loads the file BUT only will read numbers out of the file.
It won't read letters-which make words- which make
sentences-which makes me angry.
Any idea why this would be? I've tried playing around with
the .txt file encoding, would it be something in the AS code? (even
thought it has to be loading the file since it is reading the
numbers.)
Any suggestions?ok. code will follow
Whats wrong is :
I'm loading external text files (.txt) but only numbers are
showing up when loaded. It is loading numbers, so it's pulling the
right file, but it won't display any letters from the text file. I
have tired changing encoding on the .txt file with no (correct)
results.
SO basically... what would cause flash to load numbers but
not letters from an external .txt file?
note* (code uses curFrameNum in textfile name to match text
files to picture files, but that works, its just not displaying the
loaded text completely/ correctly)
Code:
// -----------------<Loading captions
A.S.>---------------- \\
frameNum.autoSize = "center";
loadedInfo.autoSize = "Left";
//--------------triger the mcl to
load------------------------\\
//myMCL.loadClip("",);
//myMCL.loadClip("slideshow2.swf",1)
//---------------LoadVars----------------------\\
var myLV:LoadVars = new LoadVars();
myLV.onLoad = function (success) {
if (success) {
loadedInfo.htmlText = true;
loadedInfo.htmlText = myLV.info;
} else {
loadedInfo.text = "There has been an error loading the
requested pictures."
//--------slide counter----------\\
var slideInfoLV:LoadVars = new LoadVars();
slideInfoLV.onLoad = function (success) {
if (success) {
slideCounter();
} else {
frameNum.text = "error";
slideInfoLV.load("vars/slide_info.txt");
var curFrameNum: Number = 0;
function loadFrame() {
myMCL.loadClip("images/mission" + curFrameNum + ".jpg",
this.framesMC);
this.myLV.load("images/mission" + curFrameNum + ".txt",0);
loadFrame();
function slideCounter() {
frameNum.text = ("picture " + (curFrameNum +1) + " of " +
Number(slideInfoLV.totalFrames));
// -----------------</caption AS>---------------- \\ -
I am struggling with what appears to be the simplest thing.
Please tell me why my highscores.php file doesn’t open
with “?playerscore=5413&playername=Rowan” after it.
When tested in a browser or on my local server, it outputs
like this: “
http://localhost/GameTest/highscores.php”
When tested from Flash (ctrl+Enter), it works perfectly. My
browser opens and displays:
“///D:/Work/GameTest/highscores.php?playerscore=5413&playername=Rowan”
in the address bar.
What am I missing here? I used Dreamweaver to create the HTML
file.
(Please download sample files
here )
I am using CS3 but file must be published as v6.Hello:
does it work with "_blank" option or not ?
also the does the "thewin" window exist before the command or
not.....if not then every thing fine and you have error alert cos
you didnt have that window before
Just Make a try
Firas Darweesh -
Problem with the FOR statement.....again!
Hi everyone,
Well I'm still trying to do a car slideshow using external
files and can't seem to see the end. The current movie is here:
http://www.virtuallglab.com/projects.html
I also attach the code. My problem is I had originally set up
an animation with 2 pictures sliding in with some text, and then
wait 4 seconds before sliding out, and then next pictures and text
would slide in and so on, using a setInterval.
The problem is the FOR loop seems to skip the setInterval and
the function "wait", so it just loops quickly and jumps to last
picture, so on the example above, it just slides the last picture
(i=9) and that's it!
Can you not include another function within a FOR statement.
Or is there a way to tell the FOR loop to wait until all motion is
finished?
Any help greatly appreciated
import mx.transitions.*;
import mx.transitions.easing.*;
for (i=0; i<10 ; i++) {
var picLeft = "pics/"+i+".jpg";
var picRight = "pics/"+i+"b.jpg";
var txtToLoad = "text/"+i+".txt";
this.createEmptyMovieClip("leftHolder",1);
leftHolder.loadMovie(picLeft,i,leftHolder.getNextHighestDepth());
leftHolder._x = -200;
leftHolder._y = 15;
var leftTween:Tween = new Tween(leftHolder, "_x",
Strong.easeOut, leftHolder._x, 10, 2, true);
this.createEmptyMovieClip("centerHolder",2);
centerHolder.loadMovie(picRight,i+"b",centerHolder.getNextHighestDepth());
centerHolder._x = 180;
centerHolder._y = 250;
var centerTween:Tween = new Tween(centerHolder, "_y",
Strong.easeOut, centerHolder._y, 15, 2, true);
text._x = 600;
myData = new LoadVars();
myData.onLoad = function(){
text.carText.text = this.content;
myData.load(txtToLoad);
var textTween:Tween = new Tween(text, "_x", Strong.easeOut,
text._x, 420, 2, true);
myInterval = setInterval(wait, 4000);
function wait() {
var leftTweenFinished:Tween = new Tween(leftHolder, "_x",
Strong.easeOut, leftHolder._x, -200, 1, true);
var centerTween:Tween = new Tween(centerHolder, "_y",
Strong.easeOut, centerHolder._y, 250, 1, true);
var textTween2:Tween = new Tween(text, "_x", Strong.easeOut,
text._x, 600, 1, true);
clearInterval(myInterval);
***************************************************************************************** ***There is no way to tell a for loop to wait. That is not what
they do.
The entire for loop will execute (if possible, and it doesn't
enter some kind of continuous infinite loop) completely before each
time the frame is rendered.
If you want to spread things out over time you need to use
the setInterval -- but not inside a for loop! If you do that you
immediately set however many intervals as your loop has. In this
case you will also assign the ids for those intervals to the same
variable, effectively overwriting the value so you will never be
able to clear most of those intervals.
So you need to rethink you whole structure. Set up some kind
of counter and limit like this:
var slidesToShow:Number=10;
var curSlide:Number=0;
Then have your setInterval increment the curSlide each time
it is called and check to see if it has shown all of them. That is
where your "loop" comes in.
As for the other part of your question -- yes you actually
have two different issues going on -- again you cannot make a for
loop wait for anything. So no there is no way to pause it while you
wait for your tween to end. But you can be notified when a tween
ends.
Check out the documentation about the tween class in the help
files. There you will find the onMotionFinished event. So you can
set up one of those to start whatever needs to be started when the
tween has finished.
You should also use the MovieClipLoader class to load your
images, because you have no idea how long it will take to load
them. Using that class you get a nice event (onLoadInit) that tells
you when the asset is ready to be used.
Finally I'm thinking you might want to use setTimeout instead
of setInterval. It only goes once, while setInterval repeats
forever. So I would think your algorithm would be something like
this.
1. load external asset
2. when ready animate in and set onMotionFinished handler
3. when motion is finished start loading next asset and
setTimeout for 4 seconds.
4. when 4 seconds is up or the clip is loaded (which ever
takes longer) go to 2 and repeat.
If this is going to be run locally on a hard drive or CD you
won't have any problem with the length of time it takes to load the
external assets, but if it is over the web it will take time. -
Hi-
I found a contact form for my Flash website but it's not working properly. It uses ActionScript 3 and PHP, both of which I don't know much about. Because of this, I can't pinpoint the problem or how to fix it. Here's what's going on:
1) Each field in the form only allows 3 characters and no special characters such as @ _ ! . , etc...
2) When the user goes to the next field in the form, the previous field appears blank but the when clicking on that again, the original text appears.
3) When submitting the form, it just keeps saying "in progress" and never shows the confirmation text nor does the email get sent. There is an HTML file included with this form but I am not sure if I need to put that in as I have embedded this form into an SWF file so I don't think I need that code but please let me know if I am wrong about this.
I am posting both the AS code and PHP code below.. if someone can help me figure this out I would greatly appreciate it. I am not sure which file the problem is in. If someone here doesn't know PHP then at least see the AS code and let me know if the problem is in that or not. That way I can pinpoint which file the problem is coming from and then seek further help if needed. To see the form in action, go here: http://www.poojasdesigns.com/ and click on "Contact Me".. here are the codes:
ActionScript 3.0
//presistant reference to this movie's mail timeline:
var mainTL:MovieClip = this;
//start off with submit button dimmed
submit_mc._alpha = 40;
//create the LoadVars objects which will be used later
//one to send the data...
var dataSender:LoadVars = new LoadVars();
//and one to recieve what comes back
var dataReceiver:LoadVars = new LoadVars();
create listener for Key Object
this is just a U.I. thing - "wakes up" the submit button
when all fields have at least some content
var formCheck:Object = new Object();
formCheck.onKeyUp = function() {
if (name_txt.text != '' &&
email_txt.text != '' &&
subject_txt.text != '' &&
message_txt.text != '') {
//clear any alert messages
alert_txt.text = '';
//enable the submit button
submit_mc._alpha = 100;
} else {
//remain disabled until all fields have content
submit_mc._alpha = 40;
Key.addListener(formCheck);
/*#######SET STYLES FOR TEXT FIELDS#######*/
//define styles for both normal and focussed
//set hex values here that work with your site's colors
var normal_border:Number = 0x000000;
var focus_border:Number = 0xFA8D00;
var normal_background:Number = 0xFFFFFF;
var focus_background:Number = 0xE9E3E3;
var normal_color:Number = 0xFFFFFF;
var focus_color:Number = 0x000000;
//create an array containing the fields we wish to have styles applied to
inputs=[name_txt,email_txt,subject_txt,message_txt];
a "for in" loop now iterates through each element in the "inputs" array
and applies our "normal" formatting to each input text field
for( var elem in inputs) {
inputs[elem].border = true;
inputs[elem].borderColor = normal_border;
inputs[elem].background = true;
inputs[elem].backgroundColor = normal_background;
inputs[elem].textColor = normal_color;
/*this takes care of applying the "normal" style to each of the four input fields;
the following TextField prototypes handle highlighting when an input field
gains focus and resetting to normal when a field loses focus*/
inputs[elem].onSetFocus = function() {
this.borderColor = focus_border;
this.backgroundColor = focus_background;
this.textColor = focus_color;
inputs[elem].onKillFocus = function() {
this.borderColor = normal_border;
this.backgroundColor = normal_background;
this.textColor = normal_color;
//finally: make the first field (name_txt) selected when the movie loads
Selection.setFocus(name_txt);
/*DEFINE SUBMIT BUTTON BEHAVIOR*/
submit_mc.onRelease = function() {
//final check to make sure fields are completed
if (name_txt.text != '' &&
email_txt.text != '' &&
subject_txt.text != '' &&
message_txt.text != '') {
alert_txt.text='';//clear any previous error messages or warnings
//advance playhead to frame 2 - the "processing" message
mainTL.play();
//assign properties to LoadVars object created previously
dataSender.name = name_txt.text;
dataSender.email = email_txt.text;
dataSender.subject = subject_txt.text;
dataSender.message = message_txt.text;
//callback function - how to handle what comes abck
dataReceiver.onLoad = function() {
if (this.response == "invalid") {
mainTL.gotoAndStop(1);
alert_txt.text = "Please verify your email address - it appears to be incorrect."
} else if (this.response == "passed") {
mainTL.gotoAndStop(4);
//now send data to script
NOTE: the line below presumes the Flash swf file and php script are in the
SAME DIRECTORY on your server. If this is not the case (if for example you
wish to put the php script along with other similar items in a "scripts"
directory) you MUST MODIFY THE PATH. Otherwise the Flash movie won't be
able to locate the php script.
dataSender.sendAndLoad("processEmail.php", dataReceiver, "POST");
} else {
//warning if they try to submit before completing
alert_txt.text = "Please fill out all the fields before submitting the form.";
PHP
<?php
//create short variable names
$name=$_POST['name'];
$email=$_POST['email'];
$subject=$_POST['subject'];
$message=$_POST['message'];
$name=trim($name);
$email=trim($email);
$subject=StripSlashes($subject);
$message=StripSlashes($message);
/*my email address - dummy address inserted for privacy in this forum*/
$toaddress='[email protected]';
if (preg_match ("/^[-_.[:alnum:]]+@((([[:alnum:]]|[[:alnum:]][[:alnum:]-]*[[:alnum:]])\.)+(ad|ae|aero|af|ag|ai|al|am|an|ao|aq|ar|arpa|as|at|au|aw|az|ba|bb|bd|be|bf|bg|bh|bi|biz|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|com|coop|cr|cs|cu|cv|cx|cy|cz|de|dj|dk|dm|do|dz|ec|edu|ee|eg|eh|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gh|gi|gl|gm|gn|gov|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|in|info|int|io|iq|ir|is|it|jm|jo|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|mg|mh|mil|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu|museum|mv|mw|mx|my|mz|na|name|nc|ne|net|nf|ng|ni|nl|no|np|nr|nt|nu|nz|om|org|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|pro|ps|pt|pw|py|qa|re|ro|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|sk|sl|sm|sn|so|sr|st|su|sv|sy|sz|tc|td|tf|tg|th|tj|tk|tm|tn|to|tp|tr|tt|tv|tw|tz|ua|ug|uk|um|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|ye|yt|yu|za|zm|zw)$|(([0-9][0-9]?|[0-1][0-9][0-9]|[2][0-4][0-9]|[2][5][0-5])\.){3}([0-9][0-9]?|[0-1][0-9][0-9]|[2][0-4][0-9]|[2][5][0-5]))$/i", $email)) {
mail($toaddress,$subject,$message,"From: $name <$email>\r\nReply-To: $email\r\nReturn-Path: $email\r\n");
//clear the variables
$name='';
$email='';
$subject='';
$message='';
echo "response=passed";
else {
echo "response=invalid";
exit;
?>
Please let me know how to proceed. Thanks so much!
*Pooja*You say you don't know much about AS3, and that you have embedded this form into an swf. In what manner did you embed it, and what version of AS does the swf use? Have you tried using the form in the page that was provided as a standalone test to see if it works?
-
Question about the sendAndLoad of LoadVars
Hi all.
I have the following code:
function testSendLoadHttp()
loaderSendAndLoad.sendAndLoad("
http://localhost:9999/",
loaderSendAndLoad,"POST");
function loaderOnLoad(s)
if (s)
Result1.text = this.var2;
else
Result1.text = "Error";
stop ();
loaderSendAndLoad = new LoadVars();
loaderSendAndLoad.var1 = "FlashLite";
testSendLoadHttp();
loaderSendAndLoad.onLoad = loaderOnLoad;
sendLoadHttpsButton.onPress = function ()
testSendLoadHttp();
I'm receiving the var1 in my Symbian server, but i'm not
getting the var2 from the server. What can happen that can cause
the loaderOnLoad to go to the else clause? Because I know that the
server sends something, but it can be sending in the wrong time or
in the wrong way. In the server i'm sending like this:
iSendBuffer.Zero();
_LIT8(HEADER,"HTTP/1.1 200 OK\r\nContent-type:
application/x-www-form-urlencoded\r\nContent-length:
12var2=Symbian\r\n\r\n");
iSendBuffer.Format(HEADER);
iSocket.Write(iSendBuffer, iStatus);Ok...Finally I solved my problem. Solutions:
1. Added Connection: close to the header, because the request
had it
2. I was sending through the wrong socket in the Symbian side
3. In my case it doesn't matter if the Content-type is
text/html or application/x-www-form-urlencoded...it worked with
both.
Thanks for your help. -
SendAndLoad fails in mac .app version - possible security setting problem?
Hi all,
I'm having trouble with sendAndLoad working on the .app version of a flash application I made. So far it's only happening on one computer, so it appears to be some sort of security setting. Here's what's going on:
I've built a flash application (Flash 9, AS2) that has three versions: an online version, a standalone .exe version for PC, and a standalone .app version for mac. The user must log in to use the application. Online, this is handled by the portal hosting the flash. In the standalone versions, the user must login through the flash application. Through sendAndLoad, it accesses the same database of user info as the online version. The user just enters username/password, clicks "Submit," and if it finds the combination in the database, it lets the user in. If not, it gives them a message saying they entered the wrong username/password.
This has tested fine across macs and pcs, but sadly one macbook can't use the .app version. It launches, they put in valid username/password, hit submit and it freezes. All I can tell is that it gets the httpStatus number 0. As you can see below, I've got it set up to spit out an error message if it fails to load (login_lv.onLoad = function(success)), but it doesn't even do that.
I've put a crossdomain.xml file at the root level of the domain that's set to allow access from any domain.
This computer can log in successfully to the online version of the course, but the .app version seems to be hampered by some sort of security setting. The problem computer's settings match the settings of a mac I've tested successfully. It has up-to-date Flash 10 and is running Leopard. Here are security settings:
System Preferences>Security
General
Everything is unchecked
FileVault
Turned off
Firewall
"Allow all incoming connections" is selected
I'd appreciate any ideas anyone has. I'm far from wise about the ins-and-outs of mac security, so I may be missing something. I'm happy to clarify anything.
Code is below. It loads login_lv first, then bookmark_lv. It never gets far enough to load bookmark_lv. The severAppUrl is set to a placeholder for confidentiality's sake. The path is defintely right. It works on other computers.
Thanks!
Mike
// create a LoadVars instance
var login_lv:LoadVars = new LoadVars();
// add the login variables to pass to the server
login_lv.userid = "";
login_lv.pwd = "";
login_lv.modname = "a";
// setup login urls
var serverAppUrl = "http://myurlhere"; //this is just a placeholder. good ol' confidentiality agreements...
var loginUrl = serverAppUrl+"login.asp";
// setup bookmark urls
var bookmarkUrl = serverAppUrl+"menu.asp";
var bookmark_lv:LoadVars = new LoadVars();
// add the bookmark variables to pass to the server
bookmark_lv.studentid = "";
bookmark_lv.isAdmin = "";
bookmark_lv.modname = "A";
_global.modnameTemp = bookmark_lv.modname;
// setup login function
function doLogin() {
login_lv.userid = login_mc.user_txt.value;
login_lv.pwd = login_mc.pwd_txt.value;
login_lv.sendAndLoad(loginUrl,login_lv,"GET");
// send the login info
login_mc.continueBtn_mc.onRelease = function() {
this.enabled = false;
doLogin();
// variables will appear in the login_lv object
login_lv.onLoad = function(success) {
if (success) {
if (this.studentid == undefined) {
login_mc._x = 0;
trace("not logged in");
debug_mc.body_txt.text+="\nnot logged in";
if(this.reas == "Please Complete Overview and first 3 Module(s) with at least 70 score."){
login_mc.loginBad_mc.gotoAndStop("r2");
login_mc.loginBad_mc._visible = true;
} else if(this.reas == "Please Complete Overview Module first."){
login_mc.loginBad_mc.gotoAndStop("r3");
login_mc.loginBad_mc._visible = true;
} else {
login_mc.loginBad_mc._visible = true;
} else {
login_mc._x = 800;
trace("now logged in");
debug_mc.body_txt.text+="\nnow logged in";
trace("studentid: "+this.studentid);
trace("isAdmin: "+this.isAdmin);
//track variables for later use
_global.studentidTemp = this.studentid;
_global.isAdminTemp = this.isAdmin;
bookmark_lv.studentid = ""+this.studentid+"";
bookmark_lv.isAdmin = ""+this.isAdmin+"";
bookmark_lv.sendAndLoad(bookmarkUrl,bookmark_lv,"GET");
}else{
debug_mc.body_txt+="\nlogin load error"
login_lv.onHTTPStatus = function(httpStatus:Number) {
this.httpStatus = httpStatus;
if(httpStatus < 100) {
this.httpStatusType = "flashError";
else if(httpStatus < 200) {
this.httpStatusType = "informational";
else if(httpStatus < 300) {
this.httpStatusType = "successful";
else if(httpStatus < 400) {
this.httpStatusType = "redirection";
else if(httpStatus < 500) {
this.httpStatusType = "clientError";
else if(httpStatus < 600) {
this.httpStatusType = "serverError";
debug_mc.body_txt.text+="\n login_lv HTTPStatus number="+httpStatus+" HTTPStatus type="+this.httpStatusType;
//prepare bookmarkXML to receive returned info from bookmark_lv function
var bookmarkXML = new XML();
bookmarkXML.ignoreWhite = true;
bookmarkXML.onLoad = bookmark_lv;
// variables will appear in the bookmark_lv object
bookmark_lv.onLoad = function(success) {
if (success) {
trace("bookmarked");
debug_mc.body_txt.text+="\nbookmarked";
trace("bookmarkXML: "+bookmarkXML);
var bookmarkNode = mx.xpath.XPathAPI.selectNodeList(this.firstChild, "/bookmark");
trace("bookmarkNode: "+bookmarkNode);
var bookmarker:String = unescape(eval("bookmark_lv"));
trace("bookmarker: "+bookmarker);
bookmarker = bookmarker.split("<xml>").join("");
bookmarker = bookmarker.split("<bookmark").join("");
bookmarker = bookmarker.split("/bookmark>").join("");
bookmarker = bookmarker.split("</xml>").join("");
var startIndex:Number;
var endIndex:Number;
startIndex = bookmarker.indexOf(">");
trace(startIndex);
endIndex = bookmarker.indexOf("<");
trace(endIndex);
var bookFinally:String;
bookFinally = bookmarker.substr(startIndex+1, endIndex-2);
bookFinally = bookFinally.split("<").join("");
setBookmarkStr = ""+bookFinally+"";
trace("string: "+setBookmarkStr);
_global.newBookmark = bookFinally;
play();
}else{
debug_mc.body_txt+="\nbookmark load error"
bookmark_lv.onHTTPStatus = function(httpStatus:Number) {
this.httpStatus = httpStatus;
if(httpStatus < 100) {
this.httpStatusType = "flashError";
else if(httpStatus < 200) {
this.httpStatusType = "informational";
else if(httpStatus < 300) {
this.httpStatusType = "successful";
else if(httpStatus < 400) {
this.httpStatusType = "redirection";
else if(httpStatus < 500) {
this.httpStatusType = "clientError";
else if(httpStatus < 600) {
this.httpStatusType = "serverError";
debug_mc.body_txt.text+="\n bookmark_lv HTTPStatus number="+httpStatus+" HTTPStatus type="+this.httpStatusType;try using different loadvars instances for your send loadvars and for your receive loadvars.
-
i created a class for my game and i've been having problems
accessing my variables. i know its a scope problem(i think) so can
anyone just point it out for me? i have been stumped for teh past
hour on this so i figured i'll just ask for a little help.
the problem is i cant get the fourLetters array. What this
program does is create a jumbled word which falls down the screen.
when you type the answer correctly, another word appears etc.
problem is, when i call creatword again and input
parentObj.fourLetters or parentObj.getCurrentList() as a parameter,
it says it is undefined. it worked the first time but why not the
second time? what happens to my array during this time?
any help would be appreciated. Thanks!
by the way, the code is included here:>>it worked the first time but why not the second time?
Most likely you are using instance properties (fourLetters,
fiveLetters) to save the LoadVars data. Then you create a new
instance but do not load the data again assuming it's already
there. And when you are using instance properties, it's not. The
properties fourLetters and fiveLetters are defined per instance. A
way to solve this is by using class properties making the content
static for all instances of the class.
private static var fourLetters:Array;
private static var fiveLetters:Array;
Maybe you are looking for
-
Weird Parsing Error in Safari 5.0
I've just updated my web browser to Safari 5.0 and I'm in a "Introduction to JavaScript" class. I'm trying to do a lab which: 1). Creates a website that includes: - Your name (First and Last) 2). Sets up a unordered list with Three links to your favo
-
Error while Processing Replenishment Delivery
Hi Experts, I have set up the Intercompany Stock Transport scenario. I have maintained the Vendor- Plant assignments and other IMG settings and created a Purchase Order as wel. While processing the RD via VL10G, am getting the error as below " 453819
-
How to setup trim for 256GB SSD for Yosemite OS 10.10.1 on Mid 2010 MacBook Pro
What is the best way to setup effective TRIM for a newly installed SanDisk Ultra Plus 256 GB (old version) drive on a mid 2010 MacBook Pro 6,2 with 8 GB RAM and running just installed Yosemite OSs 10.10.1? The new operating system is not referenced
-
Great! Create a video in half an hour! An hour later and I still can't even find my videos from iPhoto, can't import them and on top of it some of my photo's in iPhoto are greyed out. Fantastic first experience! Tried the solutions that worked for so
-
Pls help me in fixing this issue.