Reading Variable from php

I know there is a way to read PHP variables, I've seen many tutorials. What I want to do is slightly different. I need to load the flash with a variable file.

I want the user to have a url that contains a variable, PHP then get the displayed variable and load it into the flash on the page file. Is it possible to load the variable in the flash file?

URL

test.php? var = "List.Xml"

PHP Inside

validated variable

load the flash file and load the var in the actionscript code

Embeded Flash on the page or a redirect page

ActionScript uses the variable that was embedded in the URL

Any help on this would be greatly appreciated.

Thank you

Tony

You can pass the variable most directly to flash using javascript to retrieve the url (including the query string) and use the externalinterface class in flash to interrogate this js function.

Tags: Adobe Animate

Similar Questions

  • Problem passing variable from PHP to Flash

    I'm moving a single variable from PHP to Flash. However, I can't quite make it work.

    In a PHP file named data.php, I use:
    "$query = SELECT SUM (Debt) As Total OF THE debtclock;
    $result = mysql_query ($query);
    $debt = mysql_result ($result, "Total");
    Print "debttotal = $debt";

    In Flash 8 Actionscript, I use:
    loadVariables("data.php","0");

    If I understand correctly, this should make the variable available in Flash debttotal.

    Can someone tell me where I'm wrong?

    Try this:
    loadVariables ("data.php", _level0);
    The 2nd parameter specifies the target that receives variables, '0' is not a valid value for this. With _level0, variables will be found in the root timeline, so you can access it with _root.debttotal (from _level0) or _level0.debttotal (on a different level than _level0).

    Welcome,
    blemmo

  • Passing variables from flash to php script - does not!

    Hey everybody. I was wondering if someone could help me. I use as2 to pass a variable from flash to my php and nothing happened! Here's the action script code that I put on my button:

    (release)

    {

    Amount.Text = 5;

    Form1 = new LoadVars();

    Form1.amount = amount.text;

    form1.sendAndLoad ("http://mywebpage.com/test.php", rise, "POST" ');

    }

    The amount of '5' is now in a dynamic text field with the variable name and instance of amount (which, in the future, will be hidden). This works very well when the button is clicked. What I'm trying to do without success, is to get this value of '5' to my test.php and did echo and it happens simply not . It comes to my php script:

    <? PHP

    $form_inp = $_POST ["amount"];

    If ($form_inp == "'")

    {

    Print "nothing entered < br >".

    }

    on the other

    {

    Print "you entered: $form_inp";

    }

    ? >

    I'm getting "Nothing entered" every time.

    I've tried different ways for the amount.text such as:

    (release)

    {

    Amount.Text = 5;

    Form1 = new LoadVars();

    Form1.amount = this. Amount.Text;

    form1.sendAndLoad ("http://mywebpage.com/test.php", rise, "POST" ');

    }

    and

    (release)

    {

    Amount.Text = 5;

    Form1 = new LoadVars();

    Form1.amount = this ._parent. Amount.Text;

    form1.sendAndLoad ("http://mywebpage.com/test.php", rise, "POST" ');

    }

    etc...

    I also tried to change the variable name in the function sendAndLoad amount to form1 as follows:

    (release)

    {

    Amount.Text = 5;

    Form1 = new LoadVars();

    Form1.amount = amount.text;

    form1.sendAndLoad ("http://mywebpage.com/test.php",form1, "POST");

    }

    and still nothing.

    In my php file, I even tried the GET instead of the POST and it always turns out nothing.

    <? PHP

    $form_inp = $_GET['monto"];

    If ($form_inp == ")

    {

    Print "nothing entered < br >".

    }

    on the other

    {

    Print "you entered: $form_inp";

    }

    ? >

    Additional info:  I put the .swf file and at the same level-.php file in the same folder on my server just to be safe, and the dynamic amount.text text field and button are at the same level in the .swf file.

    Anyone can shed some light on my situation... pretty please? I'm out!

    Thank you very much.

    Ok. So, do not let this thread unanswered, after a looooooong of trial and error, I went to as3 and began to do some testing. It turned out that the register_globals was off on my site and that is why I did not receive the variable passed with the $_POST in my php. So what I finally proposed is the following:

    In my fla/swf doc:

    to import flash.net.URLVariables;

    import flash.net.URLRequest;

    import flash.net.sendToURL;

    var urlVariables:URLVariables = new URLVariables;

    urlVariables.amount = "5";

    var urlRequest:URLRequest = new URLRequest ("http://mirador.mx/oaxaca/disco/receive_test.php");

    urlRequest.data = urlVariables;

    sendToURL (urlRequest);

    In my php file:

    $amount = $_GET ["amount"];

    echo "' AMOUNT IS:". " $amount;

    Now for all of you who have been following this thread, or which can be read in the future, I know that we we started with AS2 and finishing here with AS3 but I didn't know why it worked until I I'm so fed up I've changed in AS3 to see if I could understand. I, like many others I guess, felt a bit intimidated with AS3 and was unwilling to give it a try, but I highly recommend that you dive into it because once get you a grip on it is much more functional.

    So I m going to mark this thread as a response and hope it saves someone else all the time and the frustration that he made me... Good programming!


  • Send variables from flash AS2 to php mySQL

    Hi I have a question to adobe. So I finally created a system to connect / register with php and mysql and flash as2. That works, and here's the link:lumosityentertainment.hostei.com/PhPLoginSystem.swf

    But I have a question. How to send variables from flash as2 to my mySQL database? And then how to load their MySQL to flash as2? Also when variables get edited or changed as if I had 6 gold and then now I have 7 but how do send flash that updated data in my database? I know you use php and other things but I have examples of easy php and codes as2? I'm a beginner in php, but I know a decent amount of AS2. I searched all over google and adobe for the answer forums, but none of them really helped. I am currently working on a flash game on my site and I'm doing so that players can save as their gold, armor, weapons etc and then load them by logging into their account.  Here is my game that I currently use cookies to save the data:

    lumosityentertainment.enjin.com/playfantasydreams

    var sendLV:LoadVars = new LoadVars();

    var receiveLV:LoadVars = new LoadVars();

    receiveLV.onData = function(src:String) {}

    trace (SRC);  or be it for debugging

    }

    sendLV.somedata = somedata;

    sendLV.someotherdata = someotherdata;

    sendLV.sendAndLoad ("yourphp.php", receiveLV, "POST");

    /////////////////////////////////

    ////

    PHP

    .

    .

    $somedata = $_POST ['somedata'];

    $someotherdata = $_POST ['someotherdata'];

    write to your sql

    {if (whatever)}

    echo "success";

    } else {}

    echo "failed."

    }

    /////////////////////////////////

    PS when you use the adobe forums, please check the useful/correct, if there is.

  • cannot switch from php to actionscript 3.0 variables

    I use CS3 and I write the following code to pass the variable to Flash from PHP

    ActionScript

    var myLoader:URLLoader = new URLLoader();

    myLoader.dataFormat = URLLoaderDataFormat.TEXT;

    var myRequest:URLRequest = new URLRequest ("http://localhost/moodle/value.php");

    myLoader.load (myRequest);

    myLoader.addEventListener (Event.COMPLETE, onCompleteHandler);

    var myValue: String;

    function onCompleteHandler(e:Event):void {}

    var $myvariable: URLVariables = new URLVariables (e.target.data);

    myValue = myvariable.values;

    trace (MyValue);

    }

    PHP file

    <? PHP

    ECHO ('values = 8');

    ? >

    But I always have the error and can not get the values using trace();

    Until I try to use 'myLoader.dataFormat = can;' I still get the same error.

    : Error #2101: the string passed to URLVariables.Decode must be a query string URL-encoded containing name/value pairs

    to Error$ /throwError)

    at flash.net::URLVariables/decode()

    at flash.net::URLVariables$iinit()

    at flash.net::URLLoader/flash.net:URLLoader::onComplete()

    Can someone help me?

    Rewrite your PHP...

    <>

    echo "values = 8;

    ?>

    edited: deleted information about different display

  • Send variables from flash to PHP

    Hello world
    I have a problem when sending variables from flash to PHP
    Here is the code:

    submit.onPress = function)
    {
    c = new LoadVars ();
    c.NME = "Myname"
    c.sendAndLoad ("getVars.php", reply, 'POST');
    }

    PHP code:

    <? PHP
    $name = $_POST ['nme'];
    Print 'your name is. " $name. «. < br / > ';
    ? >

    What I'm doing wrong here.
    I get an error message saying notice: Undefined index: name in \xxx\getVars.php on line 2

    Please help me. Thanks in advance

    2 things that I notice immediately

    1. you never initialize the variable 'Reply' to your sendAndLoad.
    2. you must pass a string encoded in URL variables which is ampersand delimited. Usually the returned string would look like echo ("" & result = 1 & msg = your % 20name % 20is %20 '. ") $name. ». 3rd % 3Cbr % &");

    Your mistake is that the information is not get passed correctly. I usually use $_REQUEST communication flash-php, although this should not make a difference. I've seen people use $_REQUEST for testing purposes and will then to $_POST when finished.

  • Can read data from xls using teststand 3.5?

    Hello

    I use 3.5 TestStand and LabVIEW 8.je know these are quite old versions now, but we must continue with this on a test bench.

    My question is how can I read data from the file xls using TestStand 3.5? I have already mentioned a few posts on this, and one response suggested that I should use "tGetExcel" using ActiveX adapter. I tried to run the test example related to "http://forums.ni.com/t5/NI-TestStand/Write-or-read-to-Excel-from-TestStand/td-p/250439/highlight/tru...", but a run-time error. He says that "the tGetExcel type library information not found. Make sure that the server is registered in the system.

    TestStand 4.2, I could easily run excel at the base of operations by using the Office Excel Toolkit.

    I was wondering, is there another way, I can read just .xls file data by using Teststand 3.5?

    Thank you

    Niraj.

    Please check this example for charger of property:

    C:\Program Files (x 86) \National Instruments\TestStand 3.5\Examples\LoadingLimits

    This shows the limits of excel file loading.

    But you can load the values of the variables-consult the help file / Reference manual for this type of step.

    Also in the loader type forum search property - you can find more information.

    I hope this helps.

  • Retrieve a variable from within a structure of business

    Hello! I am fairly new to the wonderful world of Labview. I started with the reading of most of the tutorials here and found a few basics. However, I simply don't know how to fix my latest:

    This VI is reading values from the pressure of two different instruments (labeled GPT and DPG). The first one (TPG) cannot be read, the value of the DPG is used to control the State of an event in the intake system. The idea is, that the wind opens if the pressure GET too high (P > P_max): if it's the tiny structure is 'real' and the "open wind" command is sent ('[...] box on '). The case of 'false' is empty, so the vent remains open until the GET pressure too low (in uppercase selection): If P

    This is the part that works!

    However: I want to get the time it takes from the command 'close the event' until the command "open wind" (hence the structure of tiny becoming 'real' until the upper structure is "true") and record the time spent in a file. The problem is twofold:

    (1) two cases 'true' are 'true' for more of a tick. It usually takes like ticks 4 and 5 until the vent open/closed led to a change in pressure that makes the 'false' condition once again, if I get the timestamps of 4-5 every time that one of the cases is 'true '. What I actually need is tantamount to a ' lock when you press on "initialize the timestamps, so I get a timestamp for 'close' and the other for the command 'open' for each cycle. This is also true for the order to open/close the vent system: he really needs only to send ocne, not 4 - 5 times in a row, although it does not hurt the system.

    (2) I do not really get to use timestamps to subtract and thus get the time between the two: I tunnel the timestamp of the upper structure in the bass (with ' use default if unwired ") to subtract, but since the upper case is always 'false' when the lower"true"I always get a '0' of the capital letter. I think the main question is: How can I retrieve a variable (timestamp) go in a case to use it for the most part while loop?

    I would be grateful any advice I could get on it. I also realize that this is probably a very inelegant way of doing this in labview, so if you have any suggestions on the 'better' do, I'd be happy to also implement those!

    Thank you very much!

    You must keep the two Boolean values of the case in a register to shift, in this way, you can compare the value of the new and final. If they are different, you have a signal change and use Get millisecond (in one case) to record a start time. You can also combine Boolean both in a table and use the table to the number. This way you can have a case structure that differs between Raising flank, flank Falling, high and low, and start and finish on time, calculate the difference and write to a log file, if any.

    /Y

  • How to pass Variables from the Source (SQL) to tab target (JavaBin Shell) in ODI knowledge Modules

    Hi all

    My name is Alessandro and I am new to the community.

    I have a problem with the KM stage custom when I try to pass the variable from the source to the target.

    The ODI version tha I use is the 11.1.1.5.0.

    I created a stage KM following the instructions of the metalink document (Doc ID 728636.1).

    But when I insert the value of the variable in a test table, the value in a table is the name of the variable.

    Where I'm wrong?

    I am doing thi.

    (1) create a step in my goal of shell sql source and javabin KM. In the source tab I get the value of a query, and the name "LAST_UPDATE" column.

    In the target tab, I attribute to the variabile jv_last_update the value of the variable #LAST_UPDATE, with the same name in the selection column.

    source_tab.jpgtarget_tab.jpg

    (2) I created a second stage where I insert into a table of the value of the variable jv_last_update (to debug the value of the variable):

    insert_step.jpg

    (3) when I try to see what I have in the table, the value of any line is the name of the variable "#LAST_UPDATE"; ".

    result_table.jpg

    Thanks in advance


    Alessandro

    Hi Alessandro,.

    Interesting... I have not read the Oracle document you sent yet, but one thing I can guarantee you, is that it doesn't. If Oracle says that it should work, maybe it's a bug, or maybe he has changed on new versions of ODI. I am also on ODI 11.1.1.5 and I tried many different ways to pass SQL results to variables of java with all sorts of different labels, but none of them worked for me as well. But I managed to use it in a different way, so please see below if it matches your needs:

    We are just one step. The second is just to show that it worked:

    In the first step, on the source tab, select Oracle and point to the logical schema that you want to run the query:

    On the target, note the following Java BeanShell code with the SQL that you want to run:

    Now your variable must have the correct value of your SQL. To test it, I just write a comment 'Raise' to Jython in the second step:

    The result is 'X' as expected:

    It will be useful.

    Thank you!

  • Reading data from a text (JS CS3) file tabs-delimited

    Hi - I'm working on a script to read data from a text file and use in a dialog box. But I hit a wall.

    I used a script from a previous post that defines a variable text document when the user script he chooses from a drop-down list.

    var myDialog = app.dialogs.add({name:"Map",canCancel:true});)
    {with (MyDialog)}

    {with (dialogColumns.Add ())}
    {with (borderPanels.Add ())}
    staticTexts.add ({staticLabel: "choose the location :"});})
    {with (dialogColumns.Add ())}

    var file = File("~/Desktop/myPlacesfile.txt");

    leader. Open ("r");
    var str = file.read ();
    leader. Close();
    var myPlaceList = str.split (/ [\r\n] + /);
    var myPlaceMenu = dropdowns.add ({stringList:myPlaceList, selectedIndex:0});})
    }
    }}}
    Ditto var = myDialog.show ();
    if(myResult == true) {}
    If (myPlaceMenu.selectedIndex == 0) {}
    myPlace var = ' - undefined ";
    } else {}
    myPlace var = myPlaceList [myPlaceMenu.selectedIndex];
    Alert (myPlace);
    }

    myDialog.destroy ();
    }

    That's what I do now:

    The text file is in this format:

    Value1 value2 [TAB]

    Value1 value2 [TAB]

    Value1 value2 [TAB]

    I need to have the drop down dialog box show only the value 1, and after that the user selects, the script returns only the value 2. (The alert is just there to test - I'm doing something else with the variable).

    Is there a way to view the first part of a tab-delimited line in the menu drop down and return the second half as a variable?

    Any help would be greatly appreciated.

    Thank you

    One of the possibilities is that it. Create a table to the left of the values of the tab of the dialog box. Then create an object that you use it as a table of correspondence. Roughly as follows:

    same thing as what you have

    leader. Open ("r");
    var str = file.read ();
    leader. Close();
    var array = str.split (/ [\r\n] + /);

    'pairs' are the table of correspondence

    pair of var = {};

    as before, 'myPlaceList' will be used for the menu drop-down
    var myPlaceList = [];

    var v;
    for (var i = 0; i)< array.length;="">
    {
    v = table [i] .split ('\t');
    pairs [v [0]] = v [1];
    myPlaceList.push (v [0]);
    }

    Add the drop-down list as before:

    var myPlaceMenu = dropdowns.add ({stringList:myPlaceList, selectedIndex:0});})

    the table of 'pairs' correspondence is used as follows: pairs ['value1'] returns 'value2 '.

    so in your script that would be:

    myPlace var pairs = [myPlaceList [myPlaceMenu.selectedIndex]];

    Peter

  • Pass a variable from a link to a form of mail

    Hello

    I have a site with several pages (plain html) for products, on each page, there will be a link "order".

    When you click on the link it should achieve a simple ASP email form so that the person can fill in their data (it is a very simple e-commerce if you want), but the form should also send the data / name (invisible) produced with it and display it on the contact form, ex 'you make an order for product [Product]. " ', please enter your details below.

    In short, how to pass a variable from the link on the page of the product to the contact page (and display) as well as on sending it delivers the fields of seizure of the user with the name of the hidden product.

    Thanks in advance,

    G.L.

    > I do not know how to read the query string, then

    > he spent the form

    To assign the query string value to a local variable

    DIM productID

    productID = Request.QueryString ("productID")

    To include in the form:

  • Pass Variables from JavaScript CS3 ActionScript

    Hello

    I can't understand what I'm doing wrong and I need help . Who better to ask than legal experts?

    I have everything works fine so far except for this actionscript. I use CS3 Flash with ActionScript, CS3.

    I have 5 buttons in flash.
    I try to perform the following tasks
    1. ensure buttons with effects in flash - done
    2 put the button in the down position based on the Web page that the user is on.
    To perform this dynamic, I apparently have to use 3 different languages, PHP, JavaScript, ActionScript.

    I've been playing with this during a week and can not understand. I have the rest of the scripts tested and verified to work.

    Here is the link to my test page
    http://www.spectacularstuff.com/PHP-test/inProgress/php-URL-detection.php

    Here is my code for the test. (This does not include the buttons. It is simply to test to see if I'm passing variable.)

    PHP code to detect the file name.
    <? PHP
    function curPageName() {}
    Return substr ($_SERVER ["SCRIPT_NAME"], strrpos($_SERVER["SCRIPT_NAME"],"/") + 1);
    }
    ECHO "is the current name of the page detected by PHP". curPageName();
    ? >

    The JavaScript Code to pass variables to the Flash
    < script language = "javascript" src = "swfobject.js" >
    var so = new SWFObject ("php - url - detection.swf", "php-url-detection", "550", "400", "9", "#FFFFFF");
    so. AddVariable ("currentpage","<? php echo curPageName();? >" ")
    < /script >

    ActionScript Code to get the JavaScript Variables and display them in flash.
    Dynamically create text fields
    var tf:TextField = new TextField();
    tf.autoSize = TextFieldAutoSize.LEFT;
    TF. Border = false;
    addChild (tf);

    var tf2:TextField = new TextField();
    TF2. AutoSize = TextFieldAutoSize.LEFT;
    TF2. Border = false;
    addChild (tf2);

    Create the variable to write to the page
    var myStr2:String;

    first attempt to put the variable on the page.
    This LoaderInfo must be capitlized. An error occurs if not.
    var paramObj:Object is LoaderInfo (this.root.loaderInfo).parameters.currentpage;.

    second attempt to put the variable on the page
    var myStr:String = this.root.loaderInfo.parameters.currentpage;
    trace (paramObj);
    trace (myStr);

    If (myStr is nothing)
    {
    myStr = "Flash is not reading JavaScript variables.:(";).
    myStr2 = "";
    }
    on the other
    myStr2 = "" Flash read the JavaScript variables! :)) ' "

    TF. Text = myStr; Display the URL on the page
    TF2. Text = myStr2 //Display Flash is happy

    [- End of Code-]


    Help, please.

    Thank you in advance.

    Wayne

    I found an answer to this for someone looking for an answer. I wrote the answer in another forum:
    http://Board.flashkit.com/Board/ShowPost.php?p=3946455&postcount=31

  • Bootcamp - Windows 10 should not see or read files from the disk HARD Apple intern.

    I have just successfully Windows 10 next OS X on my 15 "Macbook Pro mid-2014.

    Windows 10 should not see or read files from the disk HARD Apple intern.

    Should which driver I uninstall?

    On OSX, if the following Terminal command produces any output, then you cannot read partition OSX on the side Windows? FileVault2 will also disable access to the OSX partition.

    Cs diskutil list

  • How to read messages from a blocked number?

    How to read messages from a blocked number?

    You do not have.

    You need to unlock and then you can read the messages that comes after unlock it.

  • How to read continuously from the rs232?

    Hello

    I'm new to LabVIEW and my questions would be obvious for some for you. So please help if you know the solution.

    It's for my school project. For your information, we need to schedule a Committee of Altera DE2 to control traffic lights (something like that) and at the same time, the Commission shall forward the States of enlightenment to a computer with LabVIEW installed via an RS-232 cable.

    The rest of the project was fine except for the part of LabVIEW, because as I said earlier, I'm new to LabVIEW.

    We use the "basic series write and Read.vi" in the folder examples of NEITHER. The problem is that we do not know how to change the vi in order to receive the data that come the DE2 Board permanently. Each time, the vi stops reading after receiving 24 bytes of data.

    So, the first question is:
    1.) how to read continuously from the RS-232 port? (We tried to use while "loop" but without success, maybe we were doing it the wrong way.) If you know the solution, please enlighten us for us in a detailed manner.

    (2) Secondly, once we have received the 'chain', how can convert us to bits (0 and 1) so that we might be able to manipulate the bits, for example turn on the LEDs that correspond to the bits.

    Thank you.

    Instead of reading the bytes of the port so to read that many bytes (which may be zero), just do a VISA read for 1 byte.  He will wait for this next byte.

    To get an array of Boolean out of this byte, use this code.  He turns the characters into a byte array.  Takes the first and the only element of this array, and then converts this single U8 number into an array of bytes.

    Which country are you?  I've never seen or heard lights orange before.  Only the yellow lights.

Maybe you are looking for