Animate read variables in PHP page and print on screen

New Here ,
May 03, 2021 May 03, 2021

Copy link to clipboard

Copied

Hello

I wanted Animate to read variables (text) from a PHP page (echo $word;) and print them on the screen.
I had that functionality working in Flash / ac3, but now with Animate I can't.
I can't find any clues how to do it in the forums about Animate.
I'm asking for your help.
Thanks!

 

TOPICS
ActionScript

Views

210

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
May 04, 2021 May 04, 2021

Copy link to clipboard

Copied

var xmlhttp;

var tf = this.your_text_field;

if (window.XMLHttpRequest) { // code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp = new XMLHttpRequest();
} else { // code for IE6, IE5
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}

xmlhttp.onreadystatechange = function () {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
tf.text = xmlhttp.responseText;
}
}

xmlhttp.open("GET", "your_php_path_file.php", true);
xmlhttp.send();

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 06, 2021 May 06, 2021

Copy link to clipboard

Copied

Hello

Kglad, Adobe Community Professional

It works! Thanks a lot!

You guys are awesome, great company.

I leave simplified code/example:

 

PHP:   s1.php

<?php
$texto_1="Olá Arbor!";
echo $texto_1;
?>

 

ACTION:

var tf = this.texto_1;

if (window.XMLHttpRequest) { // code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp = new XMLHttpRequest();
} else { // code for IE6, IE5
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}

xmlhttp.onreadystatechange = function () {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
tf.text = xmlhttp.responseText;
}
}

xmlhttp.open("GET", "s1.php", true);
xmlhttp.send();

 

 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
May 06, 2021 May 06, 2021

Copy link to clipboard

Copied

LATEST

good to hear

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines