A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: [F8] using Var in dynamic text

  1. #1
    Member
    Join Date
    Aug 2007
    Posts
    33

    [F8] using Var in dynamic text

    I am storing user.data in a shared object (username)
    I am also bringing xml text into a dynamic text field later in the swf

    Is there a way to use the user.data username to replace a delimited char in xml (for example if in the xml i used 'USERNAME' - could it be replaced onLoad before it populates the swf????

  2. #2
    Member
    Join Date
    Aug 2007
    Posts
    33

    loading in XML...

    function loadXML(loaded) {
    if (loaded) {
    xmlNode = this.firstChild.nextSibling;
    bodyText = xmlNode.attributes.body;
    popupNu = [];
    popupTitle = [];
    popupBody = [];

    total = xmlNode.childNodes.length;
    for (i=0; i<total; i++) {

    popupTitle[i] = xmlNode.childNodes[i].childNodes[0].firstChild.nodeValue;
    popupBody[i] = xmlNode.childNodes[i].childNodes[1].firstChild.nodeValue;
    }
    loadPage();
    } else {
    content = "file not loaded!";
    }
    }
    xmlData = new XML();
    xmlData.ignoreWhite = true;
    xmlData.onLoad = loadXML;
    xmlData.load("L1.xml");




    should I loadXML into an array first, then replace the delimited words in the array, finally adding them to the dynamic txt field???

    or should I loadXML then replacethe words after the load???

    I have found this example:
    myText = "--!This is some test text!--";
    String.prototype.stripSign = function() {
    s1 = this.split("--!").join("");
    s2 = s1.split("!--").join("");
    return s2;
    }
    s = myText.stripSign();
    trace(s);

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center