;

PDA

Click to See Complete Forum and Search --> : import variables from php/html to km


hule2
12-08-2005, 05:49 AM
Hi there,
I want to build a php-based media-player which reads certain files from a directory (.mp3 for example). I have realised this in php so far, but
i don´t know how to submit/post/import variables from the command line/url
or rather from php´s resulting html INTO the playing-Koolmoves-swf, like
player.swf?dir=nameofsubdir/&file=nameofsound.mp3

In PHP for example i import and display variables this way:
<?php echo$_GET['subdir']; ?><?php echo$_GET['nameofsound']; ?>
... is there an analog function in KM?

Searching the forum leaded me to Loadvars which loads variables only
from a -separate file- ... this won´t help here.

any ideas / tips for me?

p.s.:
I have found these lines by necro searching the km-forum... but got no idea to handle..
"..
Try to use
loadVariables("yourpage.asp","GET"); (to receive) and
loadVariables("yourpage.asp","POST"); (to send)
instead of "getURL".
Also,don't forget that your dynamic page (ASP in this case) must be able to "format" as text array the output data:
var1=OWEN&var2=AUS&...&varn=END
cheers .."

these threads match the problem as well:
http://www.flashkit.com/board/showthread.php?t=390208&highlight=command+line
or this
http://www.flashkit.com/board/showthread.php?t=554632&highlight=command+line

blanius
12-08-2005, 09:03 AM
you can do what you want;

to get
myflash.swf?var1=something&var2=somethingelse


in PHP you just

myflash.swf?<?php echo 'var1='.$variable1.'&var2='.$variable2;?>

hule2
12-09-2005, 04:44 AM
Thanks blanius for the fast reply. But my problem is not
the php-site/post the data but the KM-site/receive the data

In KMs Actionscript i try it so far...
loadVariables("txt1","POST");
loadVariables("pfad","POST");
loadVariables("file","POST");
stop();

------> Am I on the right way?
For a better understanding i have attached the php und fun files.
sorry for my worst english.
stefan

blanius
12-09-2005, 09:18 AM
if you put the variables in the "command line" as I showed you don't have to do anything in the flash movie to retrieve them. in the example above the flash movie would just have variables named var1 and var2 set.

to get variables with loadVariables command the server must send POST or GET vars to the flash.

in the PHP you send them with an echo command

echo "?var1=".$file;

etc........then in the flash you have a variable var1 that will equal the value of the PHP variable $file.

blanius
12-09-2005, 09:27 AM
Ok looking at your code your PHP is ok except don't use txt1 as a variable name that will confuse you.
<a href="player.swf?path=<?php echo$_GET['pfad']; ?>&mytxt=JUSTATEST&file=<?php echo$_GET['file']; ?>">beta playerlink</a>

that's it!! with that the swf will have those variables path,mytxt,file To see them set your editbox variables to the same names and it will work fine.

hule2
12-09-2005, 09:46 AM
...sounds great!
I´ll give it a try ;-) THX!