Skip to main content
New Participant
December 2, 2018
Answered

Dynamic txt and img

  • December 2, 2018
  • 4 replies
  • 882 views

Hello everyone I'm really new to animate cc,  I'm wondering what the easiest way to go about loading dynamic text in a empty txt field or empty MC.  I'd like to be able to just upload and replace and or update .txt file to make site news updates easier.

Same with img,  I'd like to just upload a external Img file into a blank container MC.

I used flash MX back in the day but that was years ago.  Can anyone help?   the coding is not as simplistic as MX

    This topic has been closed for replies.
    Correct answer ClayUUID

    An example of how to load arbitrary string data into a Canvas document:

    Re: Assigning XML content to dynamic text fields

    4 replies

    Ton-UpAuthor
    New Participant
    December 10, 2018

    Thank you all that replied.  I am taking a online non accredited  JS course.  I was never a As3 pro or coder.  I'm from back in the flash kit days and flash chain. A much simpler time.  I want to keep this simple until I learn more.  Basically,  I will do this Web site in canvas html 5. Would love a big container maybe even the whole size of the background  and want to load  a flyer,  jpg or png Img dynamically so when we update events we just upload a new jpg or png to the Web server.

    And also like I said earlier I'd love to have a Web page just load news text that is a variable stored in a. Txt file ...  They seemed to change how you do this since macromedia flash.  Before you just would create dynamic txt field in flash name var,  open. Txt file add var name& the text you wanted.

    Sorry if I'm a newbie to coding I've always been a designer

    avid_body16B8
    Brainiac
    December 3, 2018

    You can also use JSON or XML and an Ajax request.

    Joseph Labrecque has a very good video about it on Lynda.com called data-driven Animation. This is a gallery that loads images and text dynamically.

    Brainiac
    December 3, 2018

    resdesign  wrote

    You can also use JSON or XML and an Ajax request.

    XMLHttpRequest IS an AJAX request. That's what the "X" stands for.

    Despite the name, XMLHttpRequest can actually load any type of text resource. So Ton-Up's text could be in a TXT file, JSON, XML, whatever.

    Ton-UpAuthor
    New Participant
    December 10, 2018

    var r = new XMLHttpRequest();

    r.open("GET", "test.xml", true);

    r.addEventListener("load", rF);

    r.send();

    function rF(e) {

    parser = new DOMParser();

    var xml = parser.parseFromString(e.target.response, "text/xml");

    alert(xml.getElementsByTagName("whatevertag")[0].childNodes[0].nodeValue);

    }


    Thank you.  So do you have all the commands memorized??  I'm having a hard time there's so many,   Or what's a good  Web site with a break down of the different JS categories and their commands...  I should print them all out. 

    ClayUUIDCorrect answer
    Brainiac
    December 3, 2018

    An example of how to load arbitrary string data into a Canvas document:

    Re: Assigning XML content to dynamic text fields

    kglad
    Community Expert
    December 3, 2018

    if as3 use the urlloader.  if html5 use an XMLHttpRequest.