Skip to main content
Known Participant
July 26, 2018
Answered

Load external text in Animate

  • July 26, 2018
  • 4 replies
  • 7741 views

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 has been closed for replies.
    Correct answer kglad

    var r = new XMLHttpRequest(); 

    r.addEventListener("load", rF);

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

    r.send(); 

    function rF(e) { 

    alert(e.target.response);

    }

    4 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?

     

    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?

    Known Participant
    June 29, 2021

    Linkage

    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.

     

    kglad
    Community Expert
    Community Expert
    January 22, 2021

    what code are you using?

    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.

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

    html5/canvas or as3?

    vatza_aAuthor
    Known Participant
    July 26, 2018

    Yes HTML, can pls help me with that?

    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);

    }