• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Load external text in Animate

Community Beginner ,
Jul 26, 2018 Jul 26, 2018

Copy link to clipboard

Copied

Hello, in flash we was able to load text in dynamic text field from external .XML file. Does anyone know how can I do that in Adobe Animate?

Views

5.6K

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

correct answers 1 Correct answer

Community Expert , Jul 26, 2018 Jul 26, 2018

var r = new XMLHttpRequest(); 

r.addEventListener("load", rF);

r.open("GET", "path/file.xml", true);  

r.send(); 

function rF(e) { 

alert(e.target.response);

}

Votes

Translate

Translate
Contributor ,
Jan 23, 2021 Jan 23, 2021

Copy link to clipboard

Copied

Of course, all files are named correctly, I've checked them double, triple, and hundreds more times. It's maybe only here in a chat are some mistakes, just describing the situation.

! But placing all those files on a server and reaching them through the web does the trick. The page can reach and load an external file.
I will never understand where is the golden key. And sorry for the fact I need those files locally - I can't do anything with them online. 

It seems to me I'll never go through... Too many questions are on their way. And I still can not "load the external text file" to get some data for use in my project further.

Thanks for helping - it's all my fault (no - stupidity)

Votes

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
Community Expert ,
Jan 23, 2021 Jan 23, 2021

Copy link to clipboard

Copied

google how to circumvent cross-domain security issues, if that's what you want.

Votes

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
Community Beginner ,
Jun 25, 2021 Jun 25, 2021

Copy link to clipboard

Copied

I've got an external text file, and i'd like to know,

I want to have each word in the file on one dynamic text field.

Can you help?

 

Votes

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
Community Expert ,
Jun 26, 2021 Jun 26, 2021

Copy link to clipboard

Copied

are the textfields on stage or are you going to create them dynamically using a movieclip with linkage id or some other way?

Votes

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
Community Beginner ,
Jun 28, 2021 Jun 28, 2021

Copy link to clipboard

Copied

Linkage

Votes

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
Community Expert ,
Jun 29, 2021 Jun 29, 2021

Copy link to clipboard

Copied

create a movieclip that contains a textfield with instance name tf.  give that movieclip a linkage of MC_TF

 

you can then use:

 

// assign your parameters

var colNum=10;

var wordspace=6;

var leading = 30;

 

// load your text file

r.open("GET", "text.txt", true);
r.addEventListener("load", rF.bind(this));
r.send();

function rF(e) {
createTF.bind(this)(e.target.response.split(" "));
}
function createTF(a){
for(i=0;i<a.length;i++){
var tf_mc = new lib.TF_MC();
tf_mc.x = (i%colNum)*wordspace;
tf_mc.y = leading*Math.round(i/colNum);
this.addChild(tf_mc);
tf_mc.tf.text = a[i];
}
}

Votes

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
Community Beginner ,
Jun 29, 2021 Jun 29, 2021

Copy link to clipboard

Copied

Oh I need to clarify. I have multiple textfields and I want one word on each.

Here, let me show you what I mean.

Votes

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
Community Expert ,
Jun 29, 2021 Jun 29, 2021

Copy link to clipboard

Copied

and what is it about the code i suggested that does not do what you want?

Votes

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
Community Beginner ,
Jun 29, 2021 Jun 29, 2021

Copy link to clipboard

Copied

It just show the text on one textbox and not the others.

I'll give the code a try.

Votes

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
Community Expert ,
Jun 29, 2021 Jun 29, 2021

Copy link to clipboard

Copied

no it's not 

Votes

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
Community Beginner ,
Jun 29, 2021 Jun 29, 2021

Copy link to clipboard

Copied

I'm using dynamic text for the text file, but I'm trying out the loop trick.

Is it possible? Thanks for the help.

Votes

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
Community Expert ,
Jun 30, 2021 Jun 30, 2021

Copy link to clipboard

Copied

LATEST

i don't understand what you're asking now and i don't understand how you could've possibly used the code i suggested and had the problem you had.  so, i suspect you're not following the suggestions i've made.

 

that's generally not an issue, but if what you use is different from what i suggest, and what you use fails, don't report that my suggestion fails.

Votes

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