AS3 to PHP to XML

Does anyone know of an example that will show me how to have
a php file save to an xml file? I want to send a php file xml data
and have that xml data saved to a xml doc on my server.
Thanks!

There are loads of tutorials on having PHP save text data to
a file, which
is all you need... I'd search on 'php save text flash' for
starters.
Dave -
www.offroadfire.com
Head Developer
http://www.blurredistinction.com
Adobe Community Expert
http://www.adobe.com/communities/experts/

Similar Messages

  • PHP generated XML files in Flash

    I want to create a flash based frontend for my image gallery
    system. I need to load in an php generated xml file (something like
    images.php). But Flash seems to load the unparsed xml file
    (webserver with php works fine). Maybe that's just happening in the
    authoring environment. I'm trying to load the xml file with the
    XML-connector. Can someone give me an advice before I do hours of
    trial'n'error business?

    It seems like I don't get my foot into the AS/XML door. My
    XML looks like this:
    <root>
    <image>
    <url>
    <name>
    <etc>
    (Close tags not shown)
    The XML file is valid and works with XML-connector. I try to
    access the XML data with this AS:
    xml_doc = new XML();
    xml_doc.load('flash.xml');
    xml_doc.onLoad = function(success) {
    //trace(this.toString());
    xml_doc.ignoreWhite = true;
    //trace(xml_doc.toString());
    trace(xml_doc);
    var mainnode:XMLNode = xml_doc.firstChild;
    var imagenodes:Array = xml_doc.firstChild.childNodes;
    for (var i:Number = 0; i < imagenodes.length; i++) {
    // for each person node:
    var imagenode:XMLNode = imagenodes
    images.push(
    {i:i+1,
    url:imagenode.childNodes[0].nodeValue,
    imagename:imagenode.childNodes[1].nodeValue
    trace(images);
    I'm not getting any values out (just 'undefined'). There
    seems to be something missing, but I just don't find out what.
    Cheers,
    Martin

  • Php generated xml trouble

    Hi,
    This is probably something dumb, but here goes...
    I've been exploring the basics of incorporating data from a MySQL table into a Flash movie by writing an XML file using PHP to read the data.  All I'm trying to do at this early stage is successfully read the data into my Flash movie and be able to access the nodes.  Here is my script which is pretty much taken from the Flash help files;
    var usageXML:XML;
    var XML_path:String="create_xml.php";
    var XML_URL:URLRequest = new URLRequest(XML_path);
    var myLoader:URLLoader = new URLLoader(XML_URL);
    myLoader.addEventListener (Event.COMPLETE, xmlLoaded);
    function xmlLoaded(event:Event):void {
        usageXML=XML(myLoader.data);
        trace("Data loaded successfully");
        trace(usageXML.day_usage[7].day_summ);
        trace(usageXML.toXMLString());
    This code works fine when I switch the file name "create_xml.php" with an xml file that I create by simply copying and pasting the source code for the php file into a new file with the file extension "xml".  But when I run the above as is, I get an error of:
    TypeError: Error #1010: A term is undefined and has no properties.
        at test_usage_reports_fla::MainTimeline/xmlLoaded()
        at flash.events::EventDispatcher/dispatchEventFunction()
        at flash.events::EventDispatcher/dispatchEvent()
        at flash.net::URLLoader/onComplete()
    Does anyone see what I am doing incorrectly for a php generated xml file versus an static xml file?
    Oh, btw, all three files (Flash movie, php file and static xml file are all in the same directory).

    I answered my own question and thought I would post it here in case someone else runs into the same confusion I had.
    I changed the name of the file from just the name of the file itself to the full path on the local server ("http://localhost/mysite/create_xml.php") and that worked.  I guess I didn't realize that Flash had to be pointed at the URL and not just the file itself.
    Now I can continue with exploring how to actually incorporate the data into the Flash movie.  Yea!

  • Passing variables from AS3 to PHP

    Hi there
    I am having some trouble in passing variables from AS3 to PHP. I am using flash and php both in the same file [try.php].
    I've stuck with this for two days.. Here's what I have done. Please help!!!
    header.fla [Actionscript in the timeline]
    stop();
    import flash.events.Event;
    import flash.display.Sprite;
    import flash.net.*;
    var url:String = "http://localhost/0000/try.php";
    var req:URLRequest = new URLRequest(url);
    var loader:URLLoader = new URLLoader();
    var variables:URLVariables = new URLVariables();
    send_btn.addEventListener(MouseEvent.CLICK, sendForm);
    function sendForm(evt:MouseEvent):void
        // add the variables to our URLVariables
        variables.asd = "value";
        // send data via post
        req.method = URLRequestMethod.POST;
        req.data = variables;
        loader.dataFormat = URLLoaderDataFormat.TEXT;
        // add listener
        loader.addEventListener(Event.COMPLETE, onLoaded);
        loader.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler);
        //send data
        loader.load(req);
    function onLoaded(evt:Event):void
        var result_data:String = String(loader.data);
        if (result_data)
            trace(result_data);
        else if (!result_data)
            trace("error");
    function ioErrorHandler(event:IOErrorEvent):void
        trace("ioErrorHandler: " + event);
    try.php
    <body>
    <object id="FlashID" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="563" height="280">
      <param name="movie" value="header.swf" />
      <param name="quality" value="high" />
      <param name="wmode" value="opaque" />
      <param name="swfversion" value="6.0.65.0" />
      <!-- This param tag prompts users with Flash Player 6.0 r65 and higher to download the latest version of Flash Player. Delete it if you don’t want users to see the prompt. -->
      <param name="expressinstall" value="../Scripts/expressInstall.swf" />
      <!-- Next object tag is for non-IE browsers. So hide it from IE using IECC. -->
      <!--[if !IE]>-->
      <object type="application/x-shockwave-flash" data="header.swf" width="563" height="280">
        <!--<![endif]-->
        <param name="quality" value="high" />
        <param name="wmode" value="opaque" />
        <param name="swfversion" value="6.0.65.0" />
        <param name="expressinstall" value="../Scripts/expressInstall.swf" />
        <!-- The browser displays the following alternative content for users with Flash Player 6.0 and older. -->
        <div>
          <h4>Content on this page requires a newer version of Adobe Flash Player.</h4>
          <p><a href="http://www.adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" width="112" height="33" /></a></p>
        </div>
        <!--[if !IE]>-->
      </object>
      <!--<![endif]-->
    </object>
    <?php
    if($_POST['asd'])
    echo "value of var1 is <b>".$_POST['asd']."</b>";
    else
    echo "bad luck";
    ?>
    </body>
    BIG THANKS!!

    the problem is nothing your showed.   did you see a security warning that you ignored?
    to test, if that's the problem go here and adjust your security settings:  http://www.macromedia.com/support/documentation/en/flashplayer/help/settings_manager04a.ht ml
    if that fails, upload your files to a server and confirm everything works.  then start working on your local configuration.

  • AS3 to PHP to MySQL issue

    I have searched for a solution over many forums and none of the code seems to work. I cannot get AS3 to work with a php script.
    I am trying to create a registration form in AS3
    and then have that information go to mysql database when
    the submit button is pressed. Here is part of the AS3 code: var variables:URLVariables = new URLVariables;
    var varSend:URLRequest = new URLRequest("register.php");
    varSend.method = URLRequestMethod.POST;
    varSend.data = variables;
    var varLoader:URLLoader = new URLLoader;
    varLoader.dataFormat = URLLoaderDataFormat.VARIABLES;
    variables.userName = user_txt.text;
    variables.userPass = pass_txt.text;
    variables.userEmail = email_txt.text;
    varLoader.load(varSend); Here is the php script "register.php": <?php $db_host = "localhost";
    $db_username = "root";
    $db_pass = "";
    $db_name = "userregister"; mysql_connect("$db_host","$db_username","$db_pass" ) or die ("could not connect to mysql");
    mysql_select_db("$db_name") or die ("no database"); $senderName = $_POST['userName'];
    $senderPass = $_POST['userPass'];
    $senderEmail = $_POST['userEmail']; $sqlCommand = "INSERT INTO user (username, password, email)
    VALUES('$senderName','$senderPass','$senderEmail') "; $query = mysql_query($sqlCommand) or die (mysql_error()); $my_msg = "Thanks $senderName, all data has been sent."; echo "return_msg=$my_msg"; ?>

    there's no problem with your flash if your textfields are passing the correct values.
    you have a table named user and it's failing to add passed variables?   if yes, use fixed strings (instead of passed variables) in your php and test your php code.

  • AS3.0 iterating through XML file

    I am new to AS3.0 and the new E4X way of working with XML.
    I'm trying to loop through a portion of an externally loaded XML
    file and display the results. Here is a portion of my XML file:
    <amenity id="1">
    <title>The Gate House</title>
    <feature>Majestic two-level Preserve Neighborhood
    Amenity Center</feature>
    <feature>Beautiful Gardens and Meandering
    Pathways</feature>
    <feature>Meeting Activity Room, Theatre Room, Gourmet
    Kitchen, Hearth Room, Grand Fireplace</feature>
    <feature>Decks and Patios</feature>
    <feature>Available to residents for parties, reunions,
    weddings, and meetings</feature>
    </amenity>
    The are other amenities as well. When a user clicks a button,
    I want to enumerate all of the features from this particular
    amenity. Here is my code to do this (the code associated with the
    listener for the button):
    function btnClick(eventObject) {
    var mc:MovieClip=eventObject.target
    var num:String = mc.name.replace("btn","")
    var xmlAmenity:XMLList = myXML.amenity.(@id==num)
    for each (var prop:XML in xmlAmenity) {
    trace (prop.feature);
    Basically the button that calls this is btn1, so the num
    variable ends up being 1. myXML is a global variable into which the
    external XML file has already been loaded. It then uses the num
    variable to assign the amenity with an id if 1 to the xmlAmenity
    variable as an XMLList. Everything works just grand except for the
    fact that the trace produces the following:
    <feature>Majestic two-level Preserve Neighborhood
    Amenity Center</feature>
    <feature>Beautiful Gardens and Meandering
    Pathways</feature>
    <feature>Meeting Activity Room, Theatre Room, Gourmet
    Kitchen, Hearth Room, Grand Fireplace</feature>
    <feature>Decks and Patios</feature>
    <feature>Available to residents for parties, reunions,
    weddings, and meetings</feature>
    I don't want the tags, just what's inside them. Is there some
    property I need to use (something like prop.feature.contents) or am
    I going about this the wrong way entirely? I suppose I could
    restructure my XML file to put the contents of the feature tag in
    an attribute called description and then trace the attribute with
    prop.feature.@description, but I'd kind of like to know how to
    access the text inside the open and close of the tag. If I access
    one directly (something like myXML.amenity.(@id==num).feature[0])
    then it works just fine, I just can't seem to figure it out in a
    loop. I suppose I could increment a variable and do something like
    trace(myXML.amenity.(@id==num).feature[x]), but there must be a
    better way.

    Goodness sakes, that was a long post for a quick answer I
    just figured out:
    My loop should read like this:
    for each (var prop:String in xmlAmenity.feature) {
    trace (prop);
    The key was enumerating through each xmlAmenity.feature, not
    xmlAmenity. Of course, if there's a better way, I'm all
    ears...

  • AS3 loading large dynamic XML

    Hi!
    I have dynamic XML file written in PHP, that I'm loading into the Flash. (http://twittersiena.lv/content.php)
    There are two problems
         - Loading takes too long time. Maybe there are some workarounds to make it load at least a bit faster. There is a way of creating static XML - it means splitting existing database records in one, and new records - to dynamic XML (so it's not requesting all Mysql rows in every single page request), but I'm not sure if it's going to make it load faster
         - When loading XML some browsers stop at apprx. 70% and does nothing. (can't figure this one out)
    The swf file, that's requesting XML file is http://twittersiena.lv
    Any ideas?

    I had the similar problem on a course, I simply minimized the tag characters to reduce the size of the xml and it loads with some speed. For example If you have <studName></studName>, you just replace that with <sNam></sNam> likewise do for many tags, then check the filesize it mostly reduced and also you should take care of the length of the tags, if you have more than 1000 then split up the for loop to read by 200 nodes at a time. I faced.

  • Php --?-- xml

    the best way to edit and create xml files in php pages?
    thanx in advance

    actually i tried DOM, but it doesn't work for me. it seems
    that i don't use the right php version, i get this error
    Parse error: parse error, unexpected T_OBJECT_OPERATOR in
    /homepages/1/d206546483/htdocs/jussieutik/test/tres.php on line 15
    this is the code i use
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
    Transitional//EN" "
    http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="
    http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html;
    charset=UTF-8" />
    <title>Untitled Document</title>
    </head>
    <?php
    $doc = new DOMDocument();
    $doc->load( 'employees.xml' );
    $employees = $doc->getElementsByTagName( "employee" );
    foreach( $employees as $employee )
    $names = $employee->getElementsByTagName( "name" );
    $name = $names->item(0)->nodeValue;
    $ages= $employee->getElementsByTagName( "age" );
    $age= $ages->item(0)->nodeValue;
    $salaries = $employee->getElementsByTagName( "salary" );
    $salary = $salaries->item(0)->nodeValue;
    echo "<b>$name - $age -
    $salary\n</b><br>";
    ?>
    <body>
    </body>
    </html>
    thanx in advance

  • AS3 to PHP

    Hey,
    Just wondering how do i integrate a php file with flash to get and recieve variables through the php file from as3?
    I would like to start off by putting as3 variables into php database.
    Then i would like to connect with an as3 variable from php to change the variable to something from the database.
    I know PHP so that isn't a problem
    Thanks.

    In that case, what you are asking for is beyond the level of effort you should expect in a forum.  What you are asking for requires a tutorial level of response.  "Hard" is a relative term, and you can only judge that relative to yourself. 
    As for your appraisal of tutorials, I disagree.  I would say most show the code needed to support the lesson -- the problem for you might just be that the lesson is not what you really want to take the time to learn.  That the code might seem advanced to you should be a clue that what you are trying to learn about is advanced.
    If you come to a forum with something to show in the way of effort, and have relevant code to show that is not working for you, then you can often get detailed help.  But if you come with a general "how do I" request, you should expect to be handed directions of where to go to find a lesson. If that happens enough you might eventually learn that you don't need to ask and can find informaton on your own.  I have found that the Flash help documentation, Google, and trial and error can help me solve just about anything.

  • AS3 alternatives to *_exclude.xml files, loading class definitions dynamically

    I've been banging my head against a wall for this for almost a couple days now and hoping that someone can point me in the right direction.
    Working in a very large Flash application, previously in AS2/CS3 I would have a setup like the following:
    root.swf
    -- modules
    ---- code_a.swf
    ---- code_b.swf
    -- views
    ---- view_a.swf
    ---- view_b.swf
    Using _exclude.xml files, I could exclude the classes defined in code_a and code_b from the ouptut .swf of view_a and view_b. root.swf would be responsible for loading the code modules before view_a or view_b, ensuring that class definitions that view_a and view_b depended on existed.
    The Problem
    We've recently migrated to using Actionscript 3/CS5. *_exclude.xml files no longer exist. To get the same functionality as above, I've tried the following:
    My setup now looks something like:
    root.swf
    -- modules
    ---- class_a.as
    ---- class_b.as
    -- views
    ---- view_a.swf
    ---- view_b.swf
    Use mxmlc to compile root.swf, view_a.swf and view_b.swf, passing it -externs option to specify classes that will be loaded externally (the two classes in modules). This ensures that the class is excluded from the compiled swf.
    Use compc to compile class_a.as and class_b.as into classes.swf, using -directory=true to access library.swf for external loading.
    However, when I try running one of the two view files which depend on classes.swf, I get runtime errors telling me that a class definition is not present.
    Current Workaround
    I've devised a workaround which I'm currently not happy with as it's backwards to the modular approach that I was previously using:
    Rather than loading the code modules, I statically link all class definitions required by child movies intoroot.swf. When building root.swf, I use the -link-report option of mxmlc to provide a list of included classes. When building child swfs, I can the use -load-externs to ensure that class definitions that already exist will not be included in the compile output.
    Is there a way that anyone is aware of to replicate the AS2/_exclude.xml solution that I had using AS3/CS5?

    I'd double check if you are loading the child SWF with correct LoaderContext and/or calling ApplicationDomain.getDefinition() correctly - otherwise you cannot access classes defined in loaded SWF files.

  • Using a dynamic PHP as XML to load?

    I want to create an XML object from a php file on the web.
    I have got my php file creating everything perfectly on the
    web...I have to view the source of the page, but it outputs
    perfectly...
    I can paste its output to an xml file, and load that to my
    swf fine, but when I try to just load the php file straight into my
    xml object it gets hung up...nothing happens.
    Is there a two step process when I want to do it this way?
    Maybe load and parse the php script, then reload the xml file
    generated??? thanks.
    http://studioauditions.com/tests3_xml.php
    is the file I am referencing in my flash 8 movie - trying to
    make it be my xml for a series of list boxes....

    I solved my problem, but thanks. The script I was using was
    sort of two fold. It was writing an actual text file and then
    pulling from that to create the php file...
    So when I updated the xml file to print and echo to both the
    browser and the text file generated it solved everything...
    you can see the tutorial I started with here
    http://thegoldenmean.com

  • Flash is complaining about XML? Im using AS3 why are there XML errors? Unknown syntax errors.

    Sorry to keep spamming these forums with my stupid errors, but I am trying really hard to learn Flash/AS3 and when I have got to grips with it, I will return the love.
    I am a flash rookie trying to make a simple calculation device and I am getting a whole world of errors I have never seen before.
    My Code (I apologise but it may be my bad syntax):
    import flash.ui.Mouse;
    var Hnum:String;
    var PCnum:String;
    var calc:Number = 25;
    var Total:Number;
    num1.restrict = "0-9";
    num2.restrict = "0-9";
    Est_btn.addEventListener(MouseEvent.CLICK, calculate);
    function PartCount(event:MouseEvent):void{
        PCnum = num2.text;
        if (PCnum > 0 && < 10){
            parseInt(PCnum) * 10;
        or if (PCnum > 11 && < 20){
            parseInt(PCnum) * 5;
        or if (PCnum > 21){
            parseInt(PCnum) * 1;
    Est_btn.addEventListener(MouseEvent.CLICK, calculate);
    function calculate(event:MouseEvent):void{
        Hnum = num1.text;
        PCnum = num2.text;
        Total = parseInt(Hnum) * calc + parseInt(PCnum);
        Total.toString();
        Total_txt.text = String(Total);
    I had everything working when I was only calculating Hnum by 25. But when I try to intergrate  the if or statement everything goes wrong and I get these 5 errors.
    Scene 1, Layer 'Actions', Frame 1, Line 15
    1104: invalid xml name
    Scene 1, Layer 'Actions', Frame 1
    1084: Syntax error: expecting xmltagendend before end of program.
    Scene 1, Layer 'Actions', Frame 1
    1084: Syntax error: expecting rightparen before end of program.
    Scene 1, Layer 'Actions', Frame 1
    1084: Syntax error: expecting identifier before end of program.
    Scene 1, Layer 'Actions', Frame 1
    1084: Syntax error: expecting rightbrace before end of program.
    I dont understand what these errors are pointing out? Why XML? is it my variable names?
    Here is the code I had before the second function that worked fine:
    var Hnum:String;
    var PCnum:String;
    var calc:Number = 25;
    var Total:Number;
    num1.restrict = "0-9";
    num2.restrict = "0-9";
    Est_btn.addEventListener(MouseEvent.CLICK, calculate);
    function calculate(event:MouseEvent):void{
         Hnum = num1.text;
         PCnum = num2.text;
         Total = parseInt(Hnum) * calc;
         Total.toString();
         Total_txt.text = String(Total);
    Any help would be greatly appreciated! I will get the hang of this!
    MrB

    Thanks guys you were right it was parse problem with the var type.
    I have changed the code adding parseInt where necessary.
    I have also added the other functions. But now after it was working fine with just the one function it is doing the strangest thing.
    There are no errors, it is running fine but it is outputting the letter "a" instead of any numbers? Is this something to do with the strings? It is most odd.
    Any help would be greatly appreciated.
    Here is the new code:
    import flash.ui.Mouse;
    var Hnum:String;
    var PCnum:String;
    var PCcalc:Number;
    var Pmath:Number;
    var calc:Number = 25;
    var Total:Number;
    num1.restrict = "0-9";
    num2.restrict = "0-9";
    Est_btn.addEventListener(MouseEvent.CLICK, calculate);
    function PartCount(event:MouseEvent):void{
        if (parseInt(PCnum) > 0 && parseInt(PCnum)< 10){
            PCcalc == 1;
        if (parseInt(PCnum) > 11 && parseInt(PCnum)< 20){
            PCcalc == 2;
        if (parseInt(PCnum) > 21 && parseInt(PCnum)<200){
            PCcalc == 3;
    Est_btn.addEventListener(MouseEvent.CLICK, calculate);
    function PartCalc(event:MouseEvent):void{
        if (PCcalc == 1){
            Pmath * 10;
        if (PCcalc == 2){
            Pmath * 5;
        if (PCcalc == 3){
            Pmath * 1;
    Est_btn.addEventListener(MouseEvent.CLICK, calculate);
    function calculate(event:MouseEvent):void{
        Hnum = num1.text;
        PCnum = num2.text;
        Total = parseInt(Hnum) * calc + Pmath;
        Total.toString();
        Total_txt.text = String(Total);
    Thanks
    MrB

  • Trouble linking AS3 and PHP to create email form

    I am using one of the Adobe cookbooks to create an email form for my flash website. I am SO close to getting this right and need some help! I used the AS3 code below as well as the PHP code below in order to create the email form. Everything seems to be working fine, that is until I try to send an email using the form. When I input all of the text into the form, I get the actionscript default warning I wrote that states "Oh no! Something is wrong! Try again..." Hence the email will not send. What could be wrong with the script? Or does it matter where I file the PHP file, my swf file, html file, and my fla file? I tried several combinations of filing everything together, seperate, and everything in between. Help! And thanks for anyone who can help!
    ACTIONSCRIPT CODE USED:
    stop();
    Buttons      
    sendbtn.buttonMode = true;
    sendbtn.addEventListener(MouseEvent.CLICK, submit);
    resetbtn.buttonMode = true;
    resetbtn.addEventListener(MouseEvent.CLICK, reset);
    Variables needed       
    var timer:Timer; var varLoad:URLLoader = new URLLoader;
    var urlRequest:URLRequest = new URLRequest( "mail.php" );
    urlRequest.method = URLRequestMethod.POST;
    Functions
    function init():void{
    //Set all fields to empty
    yourName.text = "";
    fromEmail.text = "";
    yourSubject.text = "";
    YourMsg.text = "";
    function submit(e:MouseEvent):void{
    //Check to see if any of the fields are empty
    if( yourName.text == "" || fromEmail.text == "" ||
    yourSubject.text == "" ||YourMsg.text == "" )
    { valid.text = "All fields need to be filled.";
    //Check if you're using a valid email address
    else if( !checkEmail(fromEmail.text) )
    { valid.text = "Enter a valid email address"; }
    else { valid.text = "Sending over the internet...";
    var emailData:String = "name="
    + yourName.text + "&from="
    + fromEmail.text + "&subject="
    + yourSubject.text + "&msg=" + YourMsg.text;
    var urlVars:URLVariables = new URLVariables(emailData);
    urlVars.dataFormat = URLLoaderDataFormat.TEXT;
    urlRequest.data = urlVars; varLoad.load( urlRequest );
    varLoad.addEventListener(Event.COMPLETE, thankYou );
    function reset(e:MouseEvent):void{
    init(); //call the initial clear function
    function checkEmail(s:String):Boolean {
    //This tests for correct email address
    var p:RegExp = /(\w|[_.\-])+@((\w|-)+\.)+\w{2,4}+/; var
    r:Object = p.exec(s);
    if( r == null ) {
    return false;
    return true;
    function thankYou(e:Event):void {
    var loader:URLLoader =
    URLLoader(e.target);
    var sent = new
    URLVariables(loader.data).sentStatus; if( sent == "yes" )
    valid.text = "Thanks for your email!";
    timer = new Timer(500);
    timer.addEventListener(TimerEvent.TIMER, msgSent);
    timer.start();
    else {
    valid.text = "Oh no! Something is wrong! Try again..."; }
    function msgSent(te:TimerEvent):void {
    if( timer.currentCount >= 10 ) { init();
    timer.removeEventListener(TimerEvent.TIMER, msgSent);
    PHP CODE USED
    <?php $yourName = $_POST['name'];
    $fromEmail = $_POST['from']; 
    $yourSubject = $yourSubject = $_POST['subject'];
    $YourMsg = $_POST['msg'];
    if( $yourName == true ) { $sender = $fromEmail; $yourEmail ="[email protected]";  (I have changed this to my email address, although not given in example)
    $ipAddress = $_SERVER['REMOTE_ADDR']; 
    $emailMsg = "$ipAddress \n$yourName  \n$sender
    \n\n$YourMsg 
    \n\n\n--Memo for myself--";$return = "From: $sender\r\n" .
    "Reply-To:$sender \r\n" ."X-Mailer: PHP/" . phpversion();
    if( mail( $yourEmail, "$yourSubject", $emailMsg, $return
    echo "sentStatus=yes"; }
    else { echo "sentStatus=no"; } }
    { $sender = $fromEmail; $yourEmail ="$fromEmail"; 
    $emailMsg = "\n\n\n--Memo for the sender. i.e. this is a copy of message you sent me.--
    \n\n$yourName  \n$sender
    \n$YourMsg \n";$return = "From: $sender\r\n" .
    "Reply-To:$sender \r\n" ."X-Mailer: PHP/" . phpversion();
    if( mail( $yourEmail, "$yourSubject", $emailMsg, $return
    echo "sentStatus=yes"; }
    else { echo "sentStatus=no"; } }
    ?>

    It may be indeed a problem of your server rsp. how it handles security issues and relative path-linking.
    You wrote: "Or does it matter where I file the PHP file, my swf file, html file, and my fla file..." I suppose you mean where to put all the files.
    1.Its a good beginners choice to put all the files you need (swf, html, php you don`t need the fla file on ) in the same directory of your server.
    2.If you publish to html from flash there will be three tags in the html (use a texteditor to look at the html-code) that read like this:
    <param name="allowScriptAccess" value="sameDomain" />
    change them for testing purposes to
    <param name="allowScriptAccess" value="always" />
    3.On some servers to prevent malicious code php scripts are restricted to certain directorys, look up the phpinfo on your server
    4.Even if swf, html and php are in one and the same directory use a "hard" path in your fla file for testing purposes, for example instead of calling "file.php" in your actionscript, call ("http://www.mydomain.com/directory/file.php"), when testing from flash you may get a better response where the problem lies

  • AS3 to PHP contact form, How to?

    I have my AS3 all set up as follows:
    InteractiveObject(thename.getChildAt(1)).tabIndex = 1;
    InteractiveObject(theemail.getChildAt(1)).tabIndex = 2;
    InteractiveObject(thephone.getChildAt(1)).tabIndex = 3;
    InteractiveObject(themessage.getChildAt(1)).tabIndex = 4;
    /* Mouse Click Event
    Clicking on the specified symbol instance executes a function in which you can add your own custom code.
    Instructions:
    1. Add your custom code on a new line after the line that says "// Start your custom code" below.
    The code will execute when the symbol instance is clicked.
    Enter_btn.addEventListener(MouseEvent.CLICK, fl_MouseClickHandler_2);
    function fl_MouseClickHandler_2(event:MouseEvent):void
    if (thename.text == "" || theemail.text == "" || thephone.text == "" || themessage.text == "")
    thefeedback.text = "Please fill out all fields.";
    else
    // Creat a variable container.
    var allVars:URLVariables = new URLVariables();
    allVars.name = thename.text;
    allVars.email = theemail.text;
    allVars.phone = thephone.text;
    allVars.message = themessage.text;
    // Send info to url.
    var mailAddress:URLRequest = new URLRequest("http://www.thewebsite.com/mail.php");
    mailAddress.data = allVars;
    mailAddress.method = URLRequestMethod.POST;
    sendToURL(mailAddress);
    thefeedback.text = "Thank You!";
    thename.text = "";
    theemail.text = "";
    thephone.text = "";
    themessage.text = "";
    and my PHP code written as follows:
    <?php
    //Shows where to send the email.
    //Shows what the subject will be in the email.
    $to = "[email protected]";
    $subject = "Website Reply";
    //Headers to show the information sent.
    $headers = " Name: " . $POST[thename] .
    $headers = " Email: " . $POST[theemail] .
    $headers = " 1: " . $POST[thephone] .
    $headers = " 2: " . $POST[themessage] .
    // once the variables have been defined, they can be included
    // in the mail function call which will send you an email
    mail($to, $subject, $headers);
    ?>
    [/PHP]
    What am i doing wrong i just get an empty email?
    Can someone write out the needed PHP script and explain it?
    I am compleatly new to this.

    It may be because your PHP is looking for the wrong variables. You send...
    allVars.name = blah blah;
    allVars.email = etc;
    allVars.phone = etc;
    allVars.message = etc;
    but your php is trying to process the textfield names, not the variables you sent...
    $headers = " Name: " . $POST[thename] .
    $headers = " Email: " . $POST[theemail] .
    $headers = " 1: " . $POST[thephone] .
    $headers = " 2: " . $POST[themessage] .

  • Flash Video Player, PHP, and XML

    I'm the visual designer for a web site "Global Oneness
    Project" (
    http://www.globalonenessproject.org/videos.php
    ) that's currently "streaming" progressive download quicktime
    movies. The individual video pages (where you view a video) is
    currently a php template that calls a MP4 from an XML file. Our
    goal is to switch the embedded quicktime videos to embedded Flash
    videos that play progressive download movies.
    Ideally I would like to create a single Flash Video player
    (SWF) thats embedded in a single php template (video.php), but will
    play different videos depending on what state of the php is being
    called. Basically, I want the site to work exactly like it does now
    but with Flash instead of Quicktime.
    I'm assuming that this will be created with some combination
    of an external "AS" file, the XML data and the PHP logic but can't
    even begin to get my mind around what needs to be done.
    I found a few examples of how to play multiple videos in a
    single player, but all of the examples use a playlist that's
    embedded in the SWF. The video player will only be used for player
    control and the user will choose the movie by selecting the correct
    PHP page within the HTML.
    I'll be thankful for any direction you all can give or even a
    Flash developer who would be able to take this project on.
    Thanks,
    Shawn
    [email protected]

    yes, it's possible.  and there are some similarities with an xml image gallery.  the main difference would be using something like an flvplayback component to display the videos as opposed to using a target movieclip to display the large image in an image gallery.

Maybe you are looking for