Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Creating an XML string

Posted on 2003-12-11
3
182 Views
Last Modified: 2010-04-03
In a recent project I have been working on, I have an input box that I have prevented users from entering in unapropriate words by using an array and a "for" loop.
This is what my code looks like.

badWords = ["milk", "juice", "cordial", "wine", "beer"];
mybutton.onRelease = function ()
{
     if (this._parent.txtBox.length > 0) {
          for (i in badWords) {
               if (txtBox.indexOf(badWords[i])>-1) {
          status = "No Swearing";
               return;
               }
          }
     }
}

How can I achieve this same idea, however using values from an external xml file?

Cheers

-OBCT
0
Comment
Question by:OBCT
  • 2
3 Comments
 
LVL 9

Author Comment

by:OBCT
ID: 9926492
Sorry the title was meant to be "Creating an XML array"
0
 
LVL 39

Accepted Solution

by:
blue-genie earned 500 total points
ID: 9926699
OBCT, there's another thread asking a similar thing, though he wants to use attributes, and I couldn't get that to work properly.

In a normal xml setup. ie.

<xml>
<item1>milk</item1>
<item2>juice</item2>  
<item3>cordial</item3>
<item3>wine</item3>
</xml>

you can do this.

myXML = new XML();
myXML.load("xmlFileName.xml");
myXML.ignoreWhite = true;
myXML.onLoad = processXML;
function processXML() {
      wordArray = new Array();
      for (var n = 0; n<myXML.firstChild.childNodes.length; n++) {
            wordArray[n] = myXML.childNodes[0].childNodes[n].childNodes[0];
            trace(wordArray[n] add " array items");
      }
}

so you're creating an array in flash from an xml file.
0
 
LVL 9

Author Comment

by:OBCT
ID: 9926750
Thank you, blue. You are a genius :D
Cheers for that

-OBCT
0

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
YouTube Link 10 361
Download Adobe Flash Player 6 67
Why is this simple, masked Flash animation flickering? 20 199
Can not play videos on sciencechannel.com in Chrome 13 138
There are times in your Flash CS4 application when you want more than a simple pointer or a hand, and it's hard to find an ideal walk-through to tell you what to do.  I spent a few days recently learning my way around making custom cursors in Flash,…
I have found that much of my time doing support ends up being a constant repetition of the same steps to different people.  Early on I stated using web pages with Frequently Asked Questions (FAQs) to alleviate most of the burden.  Sometimes this jus…
The goal of the tutorial is to teach the user how to how to load their YouTube profile onto Flash Media Live Encoder.
This Micro Tutorial will teach to how to utilize bit rate in Adobe Flash Media Live Encoder.

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question