Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8357839
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T10:36:49+00:00 2026-06-09T10:36:49+00:00

I am wondering if I can call a PHP script from AS3 and have

  • 0

I am wondering if I can call a PHP script from AS3 and have it recognize only the vars that are echoed out. For example.

My PHP Script called GetMyVars.php

<?
Some code...
more code..

// I want to get these vars below into flash as3

echo "$MyVars"
echo "$MoreVars"

?>

Flash AS3 Script Calling GetMyVars.php

var fl_TextLoader:URLLoader = new URLLoader();
var fl_TextURLRequest:URLRequest = new URLRequest("GetMyVars.php");

fl_TextLoader.addEventListener(Event.COMPLETE, fl_CompleteHandler);

function fl_CompleteHandler(event:Event):void
{
var textData:String = new String(fl_TextLoader.data);

 trace(fl_TextLoader.MyVars); /// I want this var in Flash
 trace(fl_TextLoader.MoreVars);  /// and this one too. :)
}

fl_TextLoader.load(fl_TextURLRequest);

Or what is the best way to do this. In short what I want to do is have a folder full of images. I want php to read those images and break them into arrays. Then I want to be able to have flash get the file names into an array and load the images fading on top of each other. Maybe there is an easier way to do this. Thanks for your kind help.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T10:36:51+00:00Added an answer on June 9, 2026 at 10:36 am

    I would recommend outputting the content from PHP as an XML file, then parsing the XML within ActionScript.

    PHP

    //Output this file as XML (not really necessary)
    header("Content-type: text/xml");
    
    //Some code...
    
    echo "<root>
    <xmlNode1>" . $MyVars . "</xmlNode1>
    <xmlNode2>" . $MoreVars . "</xmlNode2>
    </root>";
    

    ActionScript [From here]

    var xmlString:URLRequest = new URLRequest("file.php");
    var xmlLoader:URLLoader = new URLLoader(xmlString);
    xmlLoader.addEventListener(Event.COMPLETE, init);
    
    function init(event:Event):void{
      var xDoc:XMLDocument = new XMLDocument();
      xDoc.ignoreWhite = true;
    
      var myXML:XML = xmlLoader.data as XML;
      xDoc.parseXML(myXML.toXMLString());
      trace(xDoc.xmlNode1); //Outputs whatever $MyVars equals
    }
    

    I haven’t tested the above code, but it should work.

    Hope that helps.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm wondering if I can use the header(Location: someFile.php); from a script that is
I was wondering if someone can help me, I have the following script that
Possible Duplicate: How to call a JavaScript function from PHP? I have a php
I have a PHP script that calls a bash screen using exec and passes
I have a php script that gets user input (some text and a link),
Hi I was wondering how can I call a method just for one time
I was wondering how php files are actually secured. How come one can not
I have a PHP application that calls web services APIs to get some objects
Just wondering, will it be possible we can check whether the page is call
I have been writing a PHP class that is exactly 450 lines long and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.