loading external variables
#1
Posted 18 February 2007 - 03:37 PM
#2
Posted 19 February 2007 - 12:21 PM
php
<? $thing = "5" ?>
flash
stop();
loadVariables("test.php", "");
if (thingy == "word") {
gotoAndPlay(2);
}
it doesn't work and i have no idea why!
#3
Posted 19 February 2007 - 01:32 PM
Try that page. Its all about the loadvars stuff. It should help you. Note the part at the bottom about using load("myPage.php"); not working due to the php not being processed. You'll need to put it up on some sort of host (localhost or web host) for it to work.
Edited by Pax, 19 February 2007 - 01:32 PM.
#4
Posted 19 February 2007 - 02:28 PM
stop();
myVars = new LoadVars();
myVars.load("http://localhost/test.php");
myVars.onLoad = function( ){
trace(vars);
}
<?php $crap = "word"; $vars = ""; $vars .= .$crap; echo $vars ?>
the trace comes up undefined. whats going on?
#5
Posted 19 February 2007 - 03:24 PM
myVars.load("test.php");
Make sure the swf is in the same directory as test.php.
#6
Posted 19 February 2007 - 04:06 PM
#7
Posted 19 February 2007 - 04:30 PM
Ben, on Feb 19 2007, 03:24 PM, said:
myVars.load("test.php");
Make sure the swf is in the same directory as test.php.It will have to be in the same directory on the server...although, I'm not sure if that will work without using the absolute address to the php file. Make sure localhost has been set up to run php, eh?
Edit:
try:
<?php $crap = "word"; $vars = ""; $vars .= "crap=".$crap; echo $vars ?>
stop();
myVars = new LoadVars();
myVars.load("http://localhost/test.php");
myVars.onLoad = function( ){
trace(this.crap);
}
Edited by Pax, 19 February 2007 - 04:34 PM.
#8
Posted 19 February 2007 - 05:35 PM
#9
Posted 19 February 2007 - 06:57 PM
I've actually never had to use loadvars before...sooooo youre lucky it worked!
FYI, to add more vars coming in from the php, just use:
<?php $crap = "word"; $bar = "blahblah"; $myothervar = "weee"; $vars = ""; $vars .= "crap=".$crap . "&"; $vars .= "foo=".$bar. "&"; $vars .= "theOther=".$myothervar; echo $vars ?>Then the vars available to flash would be crap, foo and theOther.
#11
#12
Posted 20 February 2007 - 03:36 PM
Pax, on Feb 21 2007, 01:50 AM, said:
#13
Posted 20 February 2007 - 03:56 PM
Quote
This example loads information from a text file into text fields in the main Timeline of the movie at level 0 in the Flash Player. The variable names of the text fields must match the variable names in the data.txt file.
on(release) {
loadVariablesNum("data.txt", 0);
}
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users
