I have an SWF (a guestbook) that calls on PHP and works great when you open the swf by itself.
however,
i tried to have the SAME thing dynamically loaded into another mc and it doesnt work.
The clip shows up but it looks as though the PHP isn’t getting called correctly.
Any thoughts, or if anyones got a good guestbook tut laying around it would be much appreciated
the MC is 3 deep heres the heirarchy (spell that?)
HTMLPAGE->MAIN.swf->loads->guestbook.swf->loads-> PROBLEMFILE.swf
on the guestbook clip,
gb.loadMovie(URL); in an action frame (bg being the instance name of the lcip areea that the file is being loaded into)
The actual guesbook clip has the following in it:
NumLow = 0;
NumHigh = 10;
loadVariablesNum (“GuestBook.php?NumLow=”+NumLow+"&NumHigh="+NumHigh+"&R="+random(999), 0);
stop();
that is the problem, When specifiying 0 as the depth, you are telling Flash to load the vars into the root, instead of guestbook.
sendVars = new LoadVars();
getVars = new LoadVars();
sendVars.NumLow = NumLow;
sendVars.NumHigh = NumHigh;
sendVars.R = Math.random() * 9999;
sendVars.sendAndLoad("GuestBook.php", getVars, "GET");
getVars.onLoad = function(){
//put all your recieving actions in here.
}
all of the vars you are recieving will placed in the object getVars
and are recieveable via: getVars.yourVarName or if you are referencing them from the getVars.onLoad you can use this.yourVarName.
Are you saying to ditch what i have as code and use what you posted, or is that in addition to what i have?
Sorry, im a newb.
PS
i have 2 buttons that load the next and previous 10 entries.
code being:
on (release) {
NumLow = Number(NumLow)+Number(10);
NumHigh = Number(NumHigh)+Number(10);
GuestBook = “Loading Comments Numbered “+NumLow+” to “+NumHigh+” Please Hold”;
loadVariablesNum (“GuestBook.php?NumLow=”+NumLow+"&NumHigh="+NumHigh+"&R="+random(999), 0);
}
would that then need to change as well? (i would think any code that called on that php would need to be changed?)
Thanks, this may be going somewhere, (i dunno where) but hopefully to my resolution
Would anyone be able to explain the code above… I still cannot get this to work when loaded into a movie clip… And where
getVars.onLoad = function(){
//put all your recieving actions in here.
Im not too sure as to what should really go there.
I put this.variablenamebelow that but nothing worked in or out of a movie clip.
Thanks a ton, happy holidays!!
*Originally posted by sr1200 *
**getVars.onLoad = function(){
//put all your recieving actions in here.
Im not too sure as to what should really go there.
**
This is where you would tell the fla what to do with the variables that were returned. If you go here: http://www.dancehuladance.net/hula/dev/
You can see the little example that I made. It uses the code that norie suggested.
You type something into the first input box and then hit the red button. The php file then checks to see if you typed anything in or if you left it blank. If you did type something in then it sends that information back to the fla and it is then displayed in the second box.
Lemme know if that helps. I was having the exact same problem you were having and this is the solution that worked for me.
What i still dont understand is: I dunno what to do with the variables that i get back!
Usually when i get a variable, i put the variable name into the variable field in the properties of the dynamic text box… However here it looks as though i need to tell the variables to go there. I’m about 4 seconds from offering a fist full of money to someone to finish up this pain in the butt!!!
perhaps you could put the fla file up for me to have a gander at. Thanks
I actually like what youve got going a lot better than what i have…
I would LOVE to see and with your permission use some of that code. as long as that will work when loaded into another clip then I’d be set!
Thank you!