View Full Version : [php] Sending variables using the getURL
333944
May 31st, 2005, 09:41 AM
Hey Y'all,
My issue has to do with a communication error between my Flash movie, and a PHP script that's being called by it.
The Rundown: Shopping cart login, that has to work regardless of which page the user is viewing/logging in from.... currently it only works when you hard code the page name into the call i.e.
cmdLoginReal.onRelease = function(){
getURL ("index.php", "_self", "POST");
}
The php file has a variable called "PageName", which coincidentally enough changes each time the user visits a new page. I am passing this variable back to the flash movie through the object tag on the php page every time the swf loads, and now would like to incorporate it into the code above???? I've tried this...
cmdLoginReal.onRelease = function(){
getURL (PageName, "_self", "POST");
}
But it comes back as undefined???? Can someone please help? I guess I could test what page the user is on with some if statements, but I'd like to avoid the hard code if at all possible...
Keep on contact, Romeo
Thank-You
imported_ramie
June 1st, 2005, 11:00 AM
assign whats been posted to a variable before you put it in a geturl command
like
var post_var = whatever code to get it from php;
getURL(post_var,"_self");
333944
June 2nd, 2005, 03:55 PM
assign whats been posted to a variable before you put it in a geturl command
like
var post_var = whatever code to get it from php;
getURL(post_var,"_self");
Thanks Ramie,
After some messing around on other forums as well, I figured that out... I have another more confusing problem if your up for it???
I've since posted the login.swf file...
Every time the page refreshes a variable called "IsLogged" is passed to my Flash movie 1 = logged in, 0 = not logged in.
There are two scenes in my movie (before there were one and it was working fine) one scene has a log in button that call's a tellTarget displaying your input boxes allowing you to submit, and the other is a logged in screen that has a logout button and a hello: username message... this logout screen should only display if you have just logged in (refreshing the page and testing to see if logged in = 1) otherwise by default the when the page is loaded it will play the scene1 (login) and stop...
I have this code on scene1 of my movie (the please login scene)
ActionScript:
if (_root.logScript.text != "0"){
gotoAndPlay("scene2", "one");
}else{
gotoAndPlay("scene1", "two");
}
logScript is the instance name I've given the "IsLogged" variable (dynamic textbox on scene1 only)....
The problem is the file doesn't work sometimes it loads up fine, sometimes only half my movie loads up??? Like just some graphics (two green lines) but all my buttons are missing??? and then you have to refresh the page to see the dropdowns,buttons etc. It’s very bizarre.... also when it does work it takes a very long time to load...
I mean it logs you in ok, but just has a problem displaying the movie... it almost seems like it gets stuck somewhere????
These problems only started happening when I added the second scene (logout)
Can you please shed some light on the subject... if you care to take a look at the URL it's in its staging environments and can be found here...
http://www.golfdimples.com/catalog/
user: etalos@dconx.com
pass: password
Thanks-a-million
Romeo
imported_ramie
June 3rd, 2005, 09:00 AM
Its hard to tell whats going on in the background without knowing the php and sql that is running it, but it wouldnt load past 2 items here when i logged in, logging out shut down aswell.
You said these problem happened when you added the second frame, in the second frame are you sure its referencing the login data correctly.
you have:
if (_root.logScript.text != "0"){
gotoAndPlay("scene2", "one");
}else{
gotoAndPlay("scene1", "two");
}
try a global variable in frame 1 to get it
_global.login = _root.logScript.text;
and
if (_global.login != "0")
to test it.
If you are querying a database it could also be down to a poor design with that, dodgy sql, poor performance from server.
RB
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.