Passing php varibles to flash

I'd like to pass a variable from php to flash....the first
example below shows what works .....the second example shows what
i'd like to do but can't for some unknown reason. I think example#2
is possible because i've seen similar code all over the internet.
something is just wrong and i can't figure it out. please help me
use a php variable as part of the url string.
example #1
<?php
echo "&valid=1&;
?>
flash output is 1
example#2
<?php
$filename = "hello";
echo "&valid=$filename";
?>
flash output is $filename'';

found the answer its
....echo"&valid=".$filename;....................the movie must
be played from and html page uploading the .swf onto the webserver
and testing it gives the output of $filename;.....but if i hit f12
and create an html page with a refrence to the .swf it works
great.....BTW i'm not saying your php doesn't work i just haven't
used it.

Similar Messages

  • Pass multiple varibles from flash to authorware

    Hi there,
    if I have a button in flash and want it to send a string of
    varibales to authorware:
    --example code--
    ///flash code///
    on(release){
    fscommand("varibles", "var1, var2, var3, var4")
    ///authorware code ///
    EvalAssign(EventLastMatched[#command]^
    ":=EventLastMatched[#args]")
    Trace(EventLastMatched[#args])
    ActionFuntion(EventLastMatched[#args])
    Quit()
    In the authorware file I want to take that string and breakit
    up in authorware and apply it to the ActionFuntion.
    Please help.
    Thanks daniel

    So you have a string "var1, var2, var3, var4" that you want
    to get each
    element out of?
    repeat with i:= 1 to LineCount(EventLastMatched[#args], ",")
    lines
    :=GetLine(EventLastMatched[#args], i, i, ",")
    end repeat
    Should put each element of the sting into a separate list
    item in the
    lines linear list. I am not really understanding what you
    are tying to
    do, so I have use a list here for demonstration purpose, but
    maybe you
    want to substitute the second line with :
    ActionFunction(GetLine(EventLastMatched[#args], i, i, ","))
    Which will call ActionFunction each time the loop runs and
    send it the
    next element from the string. In your case it will call..
    ActionFunction("var1")
    ActionFunction("var2")
    ActionFunction("var3")
    ActionFunction("var4")
    Is that what you are trying to achieve?
    Mark
    deerowbear wrote:
    > Sorry I misunderstood. When I
    Trace(EventLastMatched[#args]) in authorware I
    > get var1, var2, var3, var4. The function calls an
    external dll that pass those
    > variables off and a ActionFunction to a dll file.
    >
    > thanks daniel
    >
    >
    >
    >
    Authorware Media Synchronization Command:
    www.authorwarextras.co.uk --> Commands
    Media Synchronization made easy !
    EuroTAAC eLearning 2007
    www.eurotaac.com
    www.AuthorwareXtras.co.uk
    www.freelists.org/list/flashelearning

  • LoadVars-using send to pass a variable from flash to php

    For the life of me, I've tried everything:
    I've researched LoadVars on Adobe forum, used David Powers'
    books, googled 'flash to php', LoadVars, etc. and tried
    sendAndLoad, send, and using $_POST, $_GET, $_REQUEST.
    $HTTP_POSTVARS but I keep getting this same error. any advice
    please?
    I have a Unix server running Apache/PHP 4 - LoadVars worked
    to load name-value pairs into an array -see thread)
    My goal with this simple app is to prototype being able to
    pass a variable from flash to a variable in php.
    Parse error: syntax error, unexpected T_VARIABLE in
    flash_to_SQL.php on line 5
    Actionscript 2.0 code:
    var c :LoadVars = new LoadVars();
    c.testing = "123FOUR";
    c.send ("
    http://127.0.0.1/flash_to_SQL.php","_self","POST");
    php code: (I also tried $_POST, $_GET, $_REQUEST.
    $HTTP_POSTVARS)
    <?php
    //mysql 4.1.2, php 4 , NO mysqli
    ecbo $_REQUEST ['testing'];
    /?>

    var formData:LoadVars = new LoadVars();
    formData.fname = "Name";
    formData.send("
    http://www.website.com/flash_php.php",
    formData, "POST");
    <?php
    $name = $_POST['fname'];
    echo $name;
    ?>

  • Loading php variables into flash 8

    i'm trying to load some vars into flash 8. i tried
    loadvariables, loadvariablesnum, loadvars, google. can't figure it
    out.
    2 years ago when using flash mx trying the same thing, the
    line:
    loadVariablesNum("file",0);
    was enough to do the trick.
    but in flash 8 can't get it to work ;(
    i have the simplest php file, something like this:
    <?
    $town = "where";
    $person = "who";
    $sex = "male";
    print "town=$town&person=$person&sex=$sex";
    ?>
    the use of variables is a must, so the solution
    print "town=where&person=who&sex=male"
    doesn't do me any good. actually this works.
    so what's the correct way of loading this into flash 8?
    thanks guyz.

    you can also use a FlashVars= parameter in your
    <object><embed> code, IF you are using your PHP code to
    also display your flash movie, and if you only need to pass these
    variables once when the movie loads. If this is what you need to
    do, use this....
    <object ...>
    ....// other params .....
    <param name="FlashVars" value="<?
    echo var1name;
    ?>=<?
    echo var1value;
    ?>&<?
    echo var2name;
    ?>=<?
    echo var2value;
    ?>" >
    Though you will have to do that in two places, once in the
    object code, and once in the embed code.
    The embed code would look more like
    <embed ...... FlashVars="<? //php similar to above
    ?>" ..... />
    I have used this successfully to pass in variables when the
    flash movie first loads, to pass in stuff like a URL for a link and
    other info. There are a lot of different ways to pass values in to
    flash. You can also use ExternalInterface.call and use Javascript
    along with PHP to retrieve info at any time, but that is more
    complex.
    This may not be what you need - but you can still use
    LoadVariables with Flash 8, as well.

  • Php vars to flash

    I'm useing the following scripts to pass a variable from php
    to a flash combo box....problem is I get undefined in the combo box
    when i test my movie using cntrl + enter and if i try to view the
    swf on the webserver.
    Will somebody please tell me what i'm doing wrong?

    Just a couple of notes.
    1) don't use a '$' in front of the variables you are sending
    to Flash.
    "$comboData1" should be "comboData1"
    2) Not sure about using multipl "echo" statements. I never
    have but that doesn't mean you can't.
    3) Try something straightforward first, like:
    echo 'comboData1=this is data 1';
    If that works then move up to trying the variables.
    4) The last thing to note is that your PHP variables are
    surrounded by quotes.
    "$dataForCombobox_1" should be $dataForCombobox_1
    Hope these help.
    Tim

  • Bringing php data into flash file

    I've got a php file, below is the code from it:
    <?php
    $dir = "photos/";
    // Open a known directory, and proceed to read its contents
    if (is_dir($dir)) {
    if ($dh = opendir($dir)) {
    $fileList = "";
    while (($file = readdir($dh)) !== false) {
    if ($file != "." && $file != "..") {
    If ($fileList == "") {
    $fileList = $file;
    else
    $fileList = $fileList . ", " . $file;
    echo "&newVar=$fileList";
    closedir($dh);
    ?>
    it returns a full list of files in a specified directory on
    the server.
    I need to pass that data into flash, so that it can build an
    array, and do
    other things with it.
    i can use:
    loadVariables("filename.php", "");
    and then create a text box with the variable value of
    "newVar" and it will
    display the file list, but I can't seem to get that string
    into a workable
    variable that i can do things to it.
    could someone point me to how to do this, or let me know if
    you need more
    info on it.
    thanks.

    I'm able to get the list into flash as it's currently
    written, but I can
    only get it to display in a text box instead of haveing it in
    a format that
    i can do things go.
    fileListArray = fileList.split(",");
    I've been using this code to split the php's return into an
    array of the
    file names. I just can't seem to get it to work with the
    loadvars/loadvariables stuff.
    for example, the below code works perfectly:
    var fileList:String;
    var fileListArray:Array;
    fileList = "01.jpg,02.jpg,03.jpg,04.jpg,05.jpg,06.jpg";
    fileListArray = fileList.split(",");
    when i try to display fileListArray[2] as the above code is
    written, it
    displays the correct .jpg file name. i just can't seem to
    find a way to get
    the php's return to work the same way.
    "DMennenoh **AdobeCommunityExpert**"
    <[email protected]> wrote in
    message news:f0amga$ldh$[email protected]..
    > You're close, but you don't want to return all the files
    in one variable -
    > return them all as something like file1 - filen. Then
    you can iterate file
    > in your onLoad.
    >
    > Change your PHP like so:
    >
    > <?PHP
    > $dir="photos/";
    >
    > // Open a known directory, and proceed to read its
    contents
    > if (is_dir($dir)) {
    > if ($dh = opendir($dir)) {
    > $ind = 1;
    > $fileList = "";
    > while (($file = readdir($dh)) !== false) {
    > if ($file != "." && $file != "..") {
    > $fileList .= "&file$ind=".$file;
    > $ind++;
    > }
    > }
    > echo($fileList);
    > closedir($dh);
    > }
    > }
    > ?>
    >
    >
    > Now, in your onLoad function you can do like so:
    >
    > myLoader.onLoad = function(success){
    > var ind = 1;
    > while(this['file' + ind]){
    > trace(this['file' + ind]);
    > ind++;
    > }
    > }
    >
    > Of course, you can then stick the files into an array...
    >
    >
    > HTH
    >
    > --
    > Dave -
    > Head Developer
    >
    http://www.blurredistinction.com
    > Adobe Community Expert
    >
    http://www.adobe.com/communities/experts/
    >

  • Returning php vars to flash AS

    Hi,
    I am not able to get a variable value from PHP back into
    flash after sendAndLoad. I can only get the actual value returned
    by php. here is the detail.
    Initially from flash
    dataOut.sendAndLoad("phptest.php", dataIn, "POST");
    and the return from phptest.php
    dataIn.onLoad = function() {
    msg.text = ' returned from php is '+this.value1 + this.value2
    the code in phptest.php
    <?php
    $a = "&value1=foo&";
    $b = "&value2=";
    $c = "bar&";
    echo $a.$b.$c;
    ?>
    in response
    the msg.text reads like this
    returned from php is foo";
    It only returns the actual value of value1 and not the passed
    value of value2, but one doublequote.
    and this is what is displayed in the browser from the
    phptest.php .
    &value1=foo&&value2=bar&
    any sugggestions. ?
    Thanks for any help

    thanks kglad
    but how do you pass a variable value. For example, if you
    don't want to send 'bar 'directly as the value for value2, but want
    to use the value of a variable say $c which will have a value of
    'bar', how do you pass that back to flash. In my example it won't
    pass the value of $c as 'bar', unless I actually assign 'bar' to
    value2. I need to be able to pass the value of $c rather than send
    the assigned value. I looked at the various examples including
    those from login examples, but they didn't work. has the same
    problem. somehow AS does not seem to accept the values passed via
    variable. Any other way to do it?
    thanks

  • How to read a .php file in flash

    Hi,
    Does anyone know if there's a possibility to read out a .php file in flash? (Like the iFrame in html) Some other webs showed me the 'loadvars' array..
    Thanx!

    So.. I do need to make a dynamic tekst block? And add to the first frame the action (as3?):
    var lo:URLLoader = new URLLoader();
    lo.load(new URLRequest("http://www.hcdbfeesten.nl/aenb/test.php"));
    lo.addEventListener(Event.COMPLETE, typeIt);
    function typeIt(e:Event){
        trace(lo.data);
    It does show me:
    http://www.hcdbfeesten.nl/aenb/test.swf
    Nothing... Instead of:
    http://www.hcdbfeesten.nl/aenb/test.php

  • Trouble passing a varible to INSERT page

    I'm a novice and I'm having trouble passing a varible from
    one page into the database.
    I ultimately want to pass the word "Appliances" into the
    database field name called CATEGORY.
    The user clicks on: www.xyz.com/main.cfm?category=Appliances
    to go to the next page. Then the next page has a <form> in it
    and that same page has <CFSET category=#category#>. But when
    the form posts the info into the database with the <CFINSERT>
    on the next page, CATEGORY is empty.
    I've tried: CFSET form.category=#category#>, CFSET
    form.category="#category#"> and some other things. I've even
    thought of doing this: <FORM
    ACTION="insert.cfm?category=#category#" method="post">, but that
    didn't work either (I thought I was pretty smart when I thought of
    that). :-)
    Now, I have JUST learned that I can use the <INPUT
    TYPE="hidden" NAME="category" VALUE="#category#"> to pass it BUT
    why didnt a simple CFSET statement set the variable and pass it to
    the CFINSERT?
    Thanks in advance!! -Tony

    yes, <cfinsert> tag only inserts FORM values, that is
    values defined in
    the FORM scope variables (form fields, effectively). it will
    not insert
    any values defined in any other scopes.
    a form will POST (submit) only data in its fields. that is
    why the
    variable you set with CFSET is not submitted - it is not a
    form field.
    so in order to use cfinsert you must have all data you want
    to insert
    into db in form fields. as you have found out, you can have
    hidden form
    fields to post/submit data too.
    you could also pass the variable as part of the query string
    of the
    action page: <form
    action="youractionpage.cfm?yourvar=<cfoutput>#yourvar#</cfoutput>"
    method="post">, but that variable will be available on the
    action page
    inside URL scope, not FORM scope. in order for CFINSERT to
    insert that
    variable in this case, just add <cfset form.yourvar =
    url.yourvar>
    BEFORE your CFINSERT tag on your action page.
    et voila - your variable is part of the form scope now and
    gets inserted
    with cfinsert tag.
    hope this helps.
    Azadi Saryev
    Sabai-dee.com
    http://www.sabai-dee.com

  • Php form mailer/Flash help

    I have a php form that I am using with my Flash file. It
    works great so far, but I would like to get confirmation from the
    php in the Flash file, that the info has really been sent. I think
    it is already sent up in the php, but I don't know how to handle it
    in my Flash file. The php file is attached. Do I use the echo? How
    would I do that? What I want, is in my Flash file to say sending,
    until I get then feedback from the php, and then say, sent
    successfully.
    Thanks a lot for any help!

    It is all inside an ifStatment that is inside a function,
    which gets called by the button that send the form. Here is the
    full thing.
    function validateForm(tName:String, tEmail:String,
    tSubject:String, tMsg:String):Void {
    trace("validateForm was called");
    if (tName == "" || tName == undefined) {
    trace("tName if");
    this.showAlertMsg("Please enter your name");
    } else if (tEmail == "" || tEmail == undefined ||
    tEmail.indexOf("@") == -1 || tEmail.indexOf(".") == -1) {
    trace("Invalid email address: "+tEmail+" infexOf1:
    "+tEmail.indexOf("@")+" indexOf2: "+tEmail.indexOf("."));
    this.showAlertMsg("Invalid email address");
    } else if (tSubject == "" || tSubject == undefined) {
    trace("tSubject if");
    this.showAlertMsg("Please enter a subject");
    } else if (tMsg == "" || tMsg == undefined) {
    trace("tComments if");
    this.showAlertMsg("Please enter some comments");
    } else {
    trace("the else was called...");
    var send_lv = new LoadVars();
    //send_lv.onLoad = ShowStatus;
    //send_lv.EmailType = "Quote";
    send_lv.Name = tName;
    send_lv.FromEmail = tEmail;
    send_lv.Subject = tSubject;
    send_lv.Comments = tMsg;
    send_lv.status = "";
    send_lv.sendAndLoad("php/sendContact.php",result_lv,"Post");
    this.showAlertMsg("Sending...");
    var submitListener:Object = new Object();
    submitListener.click = function(evt:Object) {
    var result_lv:LoadVars = new LoadVars();
    result_lv.onLoad = function(success:Boolean) {
    if (success) {
    this.tf_showAlertMsg.text = "Thank you for sending us an
    email";
    } else {
    this.tf_showAlertMsg.text = "Email did not go through";
    function showAlertMsg(msg:String):Void {
    this.tf_showAlertMsg.text = "";
    this.tf_showAlertMsg.text = msg;
    this.send_btn.onRelease = function() {
    validateForm(tf_Name,tf_Email,tf_Subject,tf_Comments);
    I tried the new way Dave posted and it still does not get the
    echo from the form.
    Thanks so much to both of you for the help!

  • Loading HTML or PHP page in flash

    Hi,
    I would like someone to tell me if there is a way to load html or php page in flash just like a movieclip without actually navigating from the flash player(by using getURL code). Basically, I am wondering if there is a way to load a html file just like we load movieclips and perform all the functions of html page.
    Thanks,
    Abinash

    No.  Flash can only display html content in textfields and only supports a very limited number of html tags (look up the htmlText property of TextFields).  So to display an html/php file is not possible.

  • How we can load external html or php file in flash?

    Hi there,
    I want to show my php's file desing in flash..
    i m getting data through database in php file and it has
    table... so I want to show that data in my flash movie...
    Please help me ..
    How can I load external html or php file in flash?
    If any other way is there then plz tell me.....
    thanx

    No.  Flash can only display html content in textfields and only supports a very limited number of html tags (look up the htmlText property of TextFields).  So to display an html/php file is not possible.

  • How kan i pass php data to applets

    i m developing a graphical application and i m accessing all data through php from mysql database..
    now my graphical application totally depends on that data.. how kan i pass php data over to java applets..

    I believe you use <param> tags.

  • How can i pass a varible from a page to another

    Hello ,
    if i have 2 pages for example
    page1.php and page2.php
    and i have a varible at page1.php "$x=10;"
    and i want to pass it to page2.php to use it . How ???
    bec. i am doing a site and a user enters his username and i
    want to use that username at many pages .
    Can someone please tell me an easy way to do that . thanks in
    advance

    A better way, without using SESSION variables, would be to
    have one page
    link to the next with something like this -
    <a href="pagetwo.php?variable=<?php echo $x;
    ?>">Page two
    Then on page 2 have -
    <?php $x =
    isset($_GET['variable'])?$_GET['variable']:FALSE; ?>
    Now, the variable $x on page 2 contains the value of the
    variable $x from
    page 1.
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    http://www.dreamweavermx-templates.com
    - Template Triage!
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    http://www.macromedia.com/support/search/
    - Macromedia (MM) Technotes
    ==================
    "ahmed30" <[email protected]> wrote in
    message
    news:g19l08$7k4$[email protected]..
    > It works :D
    >
    > thanks very much ....

  • Convert XML "values" to be passed as CDATA into Flash

    Hello all,
    I found the following XML - Flash quiz template on the net
    and I was wondering how can I adapt the XML doc to pass CDATA
    instead of "Value". The code is currently sending the "answers"
    values into Flash as value, instead of values I will like to type
    the answers inside of CDATA tags. I don't know how and what to
    change in the XML as well as in the AS file.
    I tried to contact the author but no use, I guess his email
    is no more
    Please see the link
    http://actionscript.org/showMovie.php?id=831
    where you can see and download the files. I will appreciatte your
    help
    Mark this message as the answer.

    http://www.explorinlauren.com/repository/xml/using-cdata-to-escape-character-entities.html

Maybe you are looking for

  • Cannot view xml report in oracle apps

    hi , i have create a sales invoice and attached it to oracle apps. the request completes with warning and the log file is having these information [9/10/07 3:34:13 PM] [5900:RT1532404] Completed post-processing actions for request 1532404. [9/10/07 3

  • U430 Touch: sound no longer working (Win 8.1)

    Dear all, a few days ago all sound stopped working on my U430. The machine runs Win 8.1 and the latest updates were installed 3 days ago - not sure if this was the same time when the sound stopped working. I tried all hints and suggested fixes I coul

  • How do I change "nobody" to "guest" in apex 2.0

    This issue has been hanging over my head for months, and I've never found the answer. I would appreciate it if someone could point me in the right direction. Thanks in advance

  • N8 Belle Nokia Gig Finder Broken?

    Upon first install it will work once or twice. Then it refuses to load. If I reinstall it, it will do the same. Work for while then later refuse to open again or allow the widget to be functional. :/ White 808 Pureview NAM Black N8 NAM Silver N95-3 N

  • SQL SERVER 2000 / 2005 ( Certificate Version )

    How to find out version of certificate in sql server 2000/2005... I am working as a client plz provide me any solution like t'sql script ........... regards ravendraindia