A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: import variables from php/html to km

  1. #1
    Member
    Join Date
    May 2005
    Location
    Germansky
    Posts
    58

    import variables from php/html to km

    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/showth...t=command+line
    or this
    http://www.flashkit.com/board/showth...t=command+line
    Last edited by hule2; 12-08-2005 at 06:20 AM.
    Let me learn from you!
    -always under construction-

  2. #2
    KoolMoves Moderator blanius's Avatar
    Join Date
    Jul 2001
    Location
    Atlanta GA
    Posts
    5,244
    you can do what you want;

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


    in PHP you just
    PHP Code:
    myflash.swf?<?php echo 'var1='.$variable1.'&var2='.$variable2;?>

  3. #3
    Member
    Join Date
    May 2005
    Location
    Germansky
    Posts
    58
    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
    Attached Files Attached Files
    Let me learn from you!
    -always under construction-

  4. #4
    KoolMoves Moderator blanius's Avatar
    Join Date
    Jul 2001
    Location
    Atlanta GA
    Posts
    5,244
    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.

  5. #5
    KoolMoves Moderator blanius's Avatar
    Join Date
    Jul 2001
    Location
    Atlanta GA
    Posts
    5,244
    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.

  6. #6
    Member
    Join Date
    May 2005
    Location
    Germansky
    Posts
    58
    ...sounds great!
    I´ll give it a try ;-) THX!
    Let me learn from you!
    -always under construction-

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center