PHP in Flash variables

Hello friends,
I m a beginner in flash. I m facing a problem in my project.
I have some variables in the file php as follows:

<? PHP
$a = "Hello";
$b = "world";
? >

I want to use the values of the variables $a and $b in my action script 3.

How can I do?

In Flash, you will need to use the URLLoader class.

http://livedocs.Adobe.com/Flash/9.0/ActionScriptLangRefV3/Flash/NET/URLLoader.html

Tags: Adobe Animate

Similar Questions

  • Help!  need of php in flash variables

    Action script below two videos (first.flv, second.flv), and then played consecutively. I want to load the videos as variables to a PHP page that this flash is embeded in - something like:

    $first_flv = "first.flv";
    $second_flv = "second.flv";

    How can I get $first_flv and $second_flv in flash variables that can replace the hardcoded ('first.flv', 'second.flv') below?


    action script

    var videoLoaderIndex:Number = 0;
    var videoPlayerIndex:Number = 0;
    var videoList:Array = new Array ('first.flv', 'second.flv');

    vidComp.contentPath = videoList [0];

    function eready(e:Object):Void {}
    If (videoLoaderIndex < videoList.length) {}
    videoLoaderIndex ++;
    vidComp.activeVideoPlayerIndex = videoLoaderIndex;
    vidComp.load (videoList [videoLoaderIndex]);
    }
    }

    vidComp.addEventListener ("ready", eready);
    function ecomplete(e:Object):Void {}
    ++ videoPlayerIndex;
    If (videoPlayerIndex > = videoList.length) {}
    videoPlayerIndex = 0;
    }

    vidComp.activeVideoPlayerIndex = videoPlayerIndex;
    vidComp.visibleVideoPlayerIndex = videoPlayerIndex;
    vidComp.play ();
    }

    vidComp.addEventListener ("complete", ecomplete);

    If you just try to pass vars to a PHP page to an animation flash on a PHP page, take a look at
    http://www.Permadi.com/Tutorial/flashQueryString/index.html
    It worked for me.

  • 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

  • sending flash variables

    I imported a file flash inside Director...
    How can I access variables that I used flash, through Director?
    How can I send variables from flash movie to the Director?
    I used this command in the animation flash a button:
    on (release) {}
    getURL ("event: FlashMouseEnter, \"hi\ "" ");
    }
    but I could not send with this command, the variables! only the channels
    What should I do about variables?

    This is how to do it (this is from my memory, so I have not tested this exact code):
    --------------------------------------------
    ACTIONSCRIPT:
    (At the beginning of your script)
    implement the listener passing variables and events Director...
    var directorListener:Object = new Object();
    directorListener.handlerName = function(evt_obj:Object):Void End Sub

    (At the end of the first picture of the script you)
    If (System.capabilities.playerType == "DirectorXtra") {}
    getURL("event:flashLoaded"); Director can now do things with the flash object!
    } else {}
    controls to test the swf outside the Director go here...
    }

    --------------------------------------------
    In the JARGON, the behavior of Flash sprite:

    on flashLoaded me
    set up an interception of calls to the directorListener function...
    SP = Sprite (spriteNum)
    Listener = SP.directorListener
    sp.setCallBack (listener, "handlerName", #lingoHandler, me)
    end

    on lingoHandler me, directorListener, flashVariables
    put flashVariables.type
    put flashVariables.target._x
    put flashVariables.selectedIndex
    end
    --------------------------------------------
    Then, back in ACTIONSCRIPT, to pass variables from Flash, not string values, use this code:
    --------------------------------------------
    call the function in the directorListener event
    directorListener.handlerName ({type: "select", target: this, selectedIndex:23});}) Flash Assoc table accessories. can be anything! Add as many times as you need. It's the object passed as a parameter in your Lingo Manager 3.

    For more information on the events and Flash<->variable Director way, see this post

  • Using Variables - I pray for you gods of AS3/PHP and Flash help!

    Please oh PLEASE! You kind souls, help this miserable person.

    Cannot get my variables to work.  My relevant articles of the code:

    AS3:
    var request: URLRequest = new URLRequest ("http://www.XXXXX.com/pages/XXXX/XXXXindex.php" ");
    Request.Method = URLRequestMethod.POST;
    var flashvars:URLVariables = new URLVariables();
    flashvars. IdTag = this.loaderInfo.parameters.id;
    flashvars.hoster = "";
    flashvars. Guest = "";
    Request.Data = flashvars;
    var loader: URLLoader = new URLLoader (request);
    loader.dataFormat = pouvez;
    Loader.Load (request);
    loader.addEventListener (Event.COMPLETE, onComplete);
    function onComplete (event: Event): void
    {
    var flashvars:URLVariables = new URLVariables (event.target.data);
    'partner'. String = flashvars.hoster;
    Comments. String = flashvars.guest;
    }

    var 'partner';
    Comments from the var;

    PHP index.php:


    <? PHP
    $hoster = $_COOKIE ['host'];
    $guest = $_POST [invited];
    ? >

    < ! DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict / / IN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" > ""
    " < html xmlns =" http://www.w3.org/1999/xhtml "lang ="fr"XML: lang ="fr"> "
    < head >
    account < title > < /title >
    < meta http-equiv = "Content-Type" content = text/html"; charset = utf-8 "/ >"
    < script type = "text/javascript" src = "swfobject.js" > < / script >
    < script type = "text/javascript" >
    var swfVersionStr = "10.1.52";
    xiSwfUrlStr var = "";
    var flashvars = "host: <? PHP echo (urlencode ($hoster))? > & Comments: <? PHP echo (urlencode ($guest))? > ';
    var params = {};
    params. Quality = "high";
    params.bgColor = "#d0e2ff";
    params. Play = "true";
    params. Loop = "true";
    params.wmode = "window";
    params. Scale = "showall";
    params.menu = "true";
    params. DEVICEFONT = "false";
    params. SALIGN = "";
    params.allowScriptAccess = "sameDomain";
    attributes of var = {};
    Attributes.ID = "check";
    Attributes.Name = "check";
    Attributes.Align = "middle";
    swfobject.createCSS ("html", "height: 100%;") background-color: #d0e2ff; ») ;
    swfobject.createCSS ("body", "margin: 0;") padding: 0; overflow: hidden; height: 100%; ») ;
    swfobject.embedSWF ("record.swf?" partner ": <? PHP echo (urlencode ($hoster))? > & Comments: <? PHP echo (urlencode ($guest))? > ","flashContent"," 750 ","650 ", swfVersionStr, xiSwfUrlStr, flashvars, params, attributes);

    The page loads, but no action.  Please tell me what I'm missing or doing wrong.

    No matter how you get variables - text file using URLLoader or FlashVars - you need to present them as a url query string. In the query, string equal - not colon - is used to separate pares them.

    Flash cannot directly read the PHP script variables. Again, you must return the text.

    In PHP, your index file should be something like:

    ECHO ("host = $_COOKIE ['host']; & guest = $_POST [guest]");

    If you want to spend flash vars in the embed code:

    To read the FlashVars embed code you get the settings of your application's loaderInfo object.

    Here's the documentation:

    http://livedocs.Adobe.com/Flash/9.0/ActionScriptLangRefV3/Flash/display/loaderInfo.html

  • Sending variables to php to Flash Builder

    Hi guys,.

    I made a form that, once sent to a Mysql server adds a table to a database.

    Here is the code I use in Flash Builder:

    ...

    "" < mx:HTTPService id = "srv" url ="http://mysite.com/addTeam.php" method = "POST">

    < mx:request >

    < format > {teamName.text} < / formatting >

    < City > {city.text} < / City >

    < / mx:request >

    < / mx:HTTPService >

    ...

    " < mx:Form x ="25"y ="10">

    " < mx:FormHeading label ="Add team"/ > "

    " < mx:FormItem label ="team name">

    " < s:TextInput id ="format"/ > "

    < / mx:FormItem >

    " < mx:FormItem label ="City">

    " < s:TextInput id ="City"/ > "

    < / mx:FormItem >

    < mx:FormItem >

    " < s:Button label ="Add"click ="srv.send ()"/ >

    < / mx:FormItem >

    And here is my addTeam.php file:

    <? PHP

    $teamName = $_POST ['format'];
    $city = $_POST ['city'];
    $addteam = $teamName. » ". $city;
    $connection = mysqli_connect ("host", "username", "password", "db") or die (mysqli_connect_error ());
    mysqli_query ($connection, "CHARACTER SET utf8" ');  the additional table will be in Bulgarian language

    $sql = "CREATE TABLE"$addteam"
    (
    FirstName varchar (20),
    Name varchar (20),
    Name varchar (20),
    position varchar (20),
    price int
    )
    ";
    mysqli_query ($connection, $sql) or die ("failed query:". "") mysqli_error ($Connection));

    ? >

    My question is: How can I find a text to Flash Builder if her request was successful or failed (as "echo") so that the user (admin in this case) knows what is going on and not just by clicking on the Add button and having to go to phpmyadmin to see if the table has been created or not?

    You stated

    <>

    ID = "srv" url ="http://mysite.com/addTeam.php" method = "POST" > "

    Just add

    result = "yourResultHandler ()" / > "

    then create the function that would deal with the result.

    <>

    "ID ="srv"url ="http://mysite.com/addTeam.php"method ="POST"result =" yourResultHandler (event) ">

  • Flash variables

    The following script adds a user name to a list of users on a flash... page at the moment a user puts there name in a text box, and then press submit... I want to modify the script so that it accepts a username of a session or cookie php variable and submits automatically unless the user press the button submit... How can I change the code to do this?... > > > >(not nessecary but) I do not care if the XML script used to add the user name because I have already a php script that makes a query on a mysql database and then converts the data in xml format. BTW, I know it can be done because I've seen Web sites on the net.

    on (release) {}
    userName = userInput; variable caught from php?
    NomSession = new XML ("< servername ="' add add username ' "/ > '");
    LiveCode.NowServer.send (sessionName);
    Request a new name to the server, the server send will automatically be a new userlist.
    }

    Oops, that should be:

    $page = str_replace('{USER}',$_GET['user'],$page);

    Or what whether the string is in your FlashVar

  • page php process flashes

    Hi all

    I have a system of 2 pages where page 1 is contact of database editing page that submits to page 2 (php only not html) which is the update/process of database php page, and then uses the tag meta to return to page 1...

    When I run the present - page 2 starts to blink for a second, then it goes back to page 1

    Q: is there a way to get rid of the flashing?

    "echo" < meta http-equiv = "Refresh" content = "0; url = myreturn.php? id ='. $_POST ['theid" "]." ' > ';

    If page 2 has no html code, you must use the header() function:

    $newURL = ' myreturn.php? id = $_POST ['theid ""]. "

    header('Location: '.$newURL);

    See if that helps.

  • Cs6 php Dreamweaver the variable code hints works not

    IM new to dreamweaver cs6 and one thing I like about cs5 was that when I typed "$" it would instantly give me a selection of variables that I had already used in my page or included in php variables ($_POST, $_SESSION, $_REQUEST...), however, now when I type "$" I get only a list of variables that I've used, and it is sometimes incorrect, for example if I used $_SESSION ['valid'] then the indication of the code would be $_SESSION.

    I already checked that my prefrences to the code hints and I all is checked.

    Anyway, my question is how to enable these types of indicators of code.

    Thanks for your help,

    solab95

    Hi, in preferences-> code advice jquery 1.7 disable code and it works.

  • Recover status twitter with PHP and FLASH show

    Report:



    Private static const username:string = 'twitter_username ';



    private static const URL: String = "http://testserver.x10.mx/test/proxy.php?url=";



    private static const REQUEST: String = URL + username;







    Call us at:

    urlLoader = new URLLoader();

    urlLoader.load (new URLRequest (REQUEST));

    urlLoader.addEventListener (Event.COMPLETE, displayInfo);

    Function:

    private void displayInfo(e:Event):void

    {

    ContentCount = 0;

    content_string = ' ';

    XML = new XML (e.target.data);

    trace (XML);

    }

    Output:

    I'm using flash to generate the results I got from proxy.php. Problem is that my flash will display all status twitter in English only. If the status is written by another language, it will display an empty state.

    Is it possible to get Chinese/Korean/Japanese or other languages?

    My text box uses the Arial font.

    When I trace (xml); He didn't show me these characters too. What's wrong?

    proxy.php

    <?php
    $name = $_GET['url'];
    $url = 'http://twitter.com/statuses/user_timeline.xml?screen_name=';
    
    
    $url .= $name;
    
    
    $ch = curl_init();
    
    
    curl_setopt ($ch, CURLOPT_URL, $url);
    curl_setopt ($ch, CURLOPT_HEADER, 0);
    
    
    ob_start();
    
    
    curl_exec ($ch);
    curl_close ($ch);
    $string = ob_get_contents();
    
    
    $content = ob_end_clean();
    
    
    //$content = get_content("");
    echo $string;
    ?>
    

    Yes, which is not built-in glyphs you want. For a simple example, add MS UI Gothic or (good God) Adobe Heiti Std you know where it will contain glyphs. Try not to pass out when you see how long it takes to export the SWF file or how big it is. You should now see your characters.

    I really think you should consider using device fonts. Even just for a test. Define the textfield does NOT integrate and include a device font that you know supports the characters and assign it to the TextField. Your Chinese should appear here (all other languages that the police have glyphs for), without adding to the size of the SWF file.

    In flash builder, you have the option of specifying fonts beaches to integrate that you don't have with flash CS5.5. It's not fair, but that's how it is. Your system (usually the value latin/English) code page is read by flash and he decides what you mean by 'includes all the glyphs '. Even when you select include all, it won't. But if you are in China on a Chinese OS, it includes these glyphs as the code page is set differently. Stupid Flash... The only way to break the balance, is to use a known set of Asian fonts. Beware, some fonts include the Chinese but not Korean or Arabic or Japanese, etc. Find a universal policy weighs a TON in the size of the file.

    250 k... I wish

  • Profiler PHP in Flash Builder 4.5

    Hey there, I use Flash Builder 4.5 for PHP Premium. I noticed on the features page, http://www.adobe.com/products/flash-builder-php/features._sl_id-contentfilter_sl_featuredi splaytypes_sl_top.html, he announces "profiling PHP". I would like to try this feature, but I can't find information on how to open a PHP profiling session. Pointers would be greatly appreciated, I do not know it is simple once you know how.

    Thank you

    Hope this page helps http://files.zend.com/help/Zend-Studio/profiling.htm

  • PHP and flash

    I am currently using PHP to access MYSQL databases and some other functions it can be used for such as form validation (and treatment during the successful validation)

    (1) is it possible for me to use PHP in a flash application to access MYSQL databases or am I forced to use for that?
    and if it is possible I make then must use the PHP to print command to print the AS resulting from it, just as I would normally use to print the HTML and JAVASCRIPT required

    (2) same question but regarding using PHP to validate the FLASH formulas (IE controls entry and if it will not somehow insert an error message in the page flash that was not there before) for an example of what I mean by that look on this HTML form I used PHP on http://axfordengineeringservices.co.uk/contact.php (it's an online site so won't send messages of) guys just click on the button send without filling out any part of the form and it will reload the page with an error message but not send anything)

    You need PHP (or some other script on the server side) to interact with databases and process forms.  ActionScript cannot address these issues directly, and PHP is often the man in the Middle for this type of functionality.  You can visit gotoandlearn.com and through some of the video tutorials there on these topics.

  • To access PHP (especially _SESSION) variables

    Hello

    Since CaioToOn! here suggested I should use $_SESSION and I need to do anyway, I've spent the last 1 + hours trying to figure out how to do this. Unfortunately, I could not really understand except that there seems to be a problem with the session ID and it must be passed to the swf file.

    Can someone tell me please how read/write from/to PHP variables (not $_GET)?

    P.S.: Here's a simple example of code (test.php and then the testintro.fla CODE):

    <? session_start();
    
    $_SESSION["intro"] = 0;     // has the intro been played?
    
    ...     // code for including the swf
    ?>
    

    if(intro == 0)
    {
         myclip.gotoAndPlay(2);   // play intro
         intro = 1;
    }
    else
    { myclip.gotoAndPlay(24); }     // skip the intro and go straight to the end
    

    What are you trying to make (the basic level)?

    It seems you are trying to have a php file to embed a swf file.  posing problems.  I'm more interested in why you would try a problematic approach to the incorporation of a swf file.

  • How to assign the value to a dynamically created flash variable.

    I want to change the value of a variable that is in another flash movie. I loaded the swf file. Inside the function "onLoadInit", I wrote code like below.

    loadListener.onLoadInit = function(target_mc:MovieClip):Void
    {

    This [target_mc + "."] contents.obj.' + mcSelfObj. m_TemparVariables [w] .varname] = 'Left ';

    where mcSelfObj. m_TemparVariables [w] .varname contains 'position', which is the variable I want to change. This declaration is not assign a value to the variable.

    If I hardcode the above statement as below it works

    target_mc.contents.obj.position = 'Left ';

    }

    In the previous version of flash, we used eval() to make over assignments.

    While you don't seem to use AS3, try...

    [mcSelfObj.m_TemparVariables [w] .varname] target_mc.contents.obj = "Left";

    based on what you say works, which is the best I can do to determine where the media should be.

    If these are all a form of variable identity rather than the names of instnance, then you will need to use parentheses for each instance and do not use points

  • Loading the output of php in flash to determine the message

    Hello

    I use the following tutorial to create a message from php page, however, even in their example, I can't get the php echo function to send the output to the dynamic text fields: http://www.sephiroth.it/tutorials/flashPHP/email/index.php .

    Here is the code for the button send php variables and to attempt to capture the echo php 'sent' or 'error '.

    on (release) {
        //    Now import the variables we
        //    need to send in this movie clip
        sender_mail = _root.Semail.text
        sender_name = _root.Sname.text
        sender_subject = _root.Ssubject.text
        sender_message = _root.Smessage.text
        //    all the vars we just imported
        //    will be sent via POST method now
        loadVariables("sendmail.php",this,"POST");
        //    and when receives the answer from
        //    the server...
        this.onData = function()
        {
            //    ok, next frame
            _root.nextFrame();
            if(this.output=='sent')
            {
                // in case of success
                _root.errTitle = 'Thank You.';
                _root.errType = "Your message has been succesfully sent.";
            } else {
                //    else
                _root.errTitle = "Error!";
                _root.errType = "Attention, an error occurred. Please try again later.";
            }
        }
    }

    Here is the php which should echo the "sent" or "error"

    <?
    if(!empty($HTTP_POST_VARS['sender_mail']) || !empty($HTTP_POST_VARS['sender_message']) || !empty($HTTP_POST_VARS['sender_subject']) || !empty($HTTP_POST_VARS['sender_name']))
    {
         $to = "[email protected]";
         $subject = stripslashes($HTTP_POST_VARS['sender_subject']);
         $body = stripslashes($HTTP_POST_VARS['sender_message']);
         $body .= "\n\n---------------------------\n";
         $body .= "Mail sent by: " . $HTTP_POST_VARS['sender_name'] . " <" . $HTTP_POST_VARS['sender_mail']  . ">\n";
         $header = "From: " . $HTTP_POST_VARS['sender_name'] . " <" . $HTTP_POST_VARS['sender_mail'] . ">\n";
         $header .= "Reply-To: " . $HTTP_POST_VARS['sender_name'] . " <" . $HTTP_POST_VARS['sender_mail'] . ">\n";
         $header .= "X-Mailer: PHP/" . phpversion() . "\n";
         $header .= "X-Priority: 1";
         if(@mail($to, $subject, $body, $header))
         {
              echo "output=sent";
         } else {
              echo "output=error";
         }
    } else {
         echo "output=error";
    }
    ?>

    The email does send fine, but it does not show the message which lets the user know the status of the message.  Any ideas?  There is a link to download the .zip file of the tutorial - I have attached it here.

    place these two textfields in their own frame of _root 1.  Add a picture (but NOT a keyframe) in box 2 layer of the textfields.  Repeat the test.

Maybe you are looking for