Skip to main content
Known Participant
July 26, 2018
Answered

Load external text in Animate

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?

    This topic is closed to new replies. Start a new post to keep the conversation going.
    kglad
    kgladCorrect answer
    Community Expert
    July 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);

    }

    36 replies

    Known Participant
    June 26, 2021

    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?

     

    Translate
    kglad
    Community Expert
    Community Expert
    June 26, 2021

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

    Translate
    Known Participant
    June 29, 2021

    Linkage

    Translate
    berzins
    Inspiring
    January 22, 2021

    I wonder for many things including why this works for me only in the preview window - directly opened by Animate. 

    As I open exported HTML file in the browser - that external content doesn't show up anymore. Why?
    I'm on the way to create the page where the Name on the screen will be chosen randomly from an external text file. It works less or more ok in AS but I can't figure out how to move it to HTML canvas.

     

    Translate
    kglad
    Community Expert
    Community Expert
    January 22, 2021

    what code are you using?

    Translate
    berzins
    Inspiring
    January 22, 2021

    The same from here marked as the correct answer. It does the thing only when hit cmd+Enter. After opening the HTML file from the disk none of the external content loads.

    Translate
    Community Expert
    July 26, 2018
    kglad
    Community Expert
    Community Expert
    July 26, 2018

    html5/canvas or as3?

    Translate
    vatza_aAuthor
    Known Participant
    July 26, 2018

    Yes HTML, can pls help me with that?

    Translate
    kglad
    Community Expert
    kgladCommunity ExpertCorrect answer
    Community Expert
    July 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);

    }

    Translate