Flash AS3 & XML

I was wondering if someone can help me.  I am doing a project that consists of AS3 in flash an importing an external xml data that will populate dynamic data in text fields in my flash project.  The xml is all ready set up  (pre exsisting)  data. The structure of the XML Code looks like this:
<GlobalDynamicData xmlns:xsi"http://www.w3.org/2001/xmlschema-instance">
<schema version 1.0.0>version 1</schemaversion>
<DynamicDataFields>
<DynamicDataField>
<DataField> AlertOn</DataField>
<DataValue>0</DataValue
<DataValueChange>2010-08-07</DataValueChange>
</DynamicDataFields>
<DynamicDataFields>
<DynamicDataField>
<DataField> AlertImage1</DataField>
<DataValue>example.jpg</DataValue
<DataValueChange>2010-08-07</DataValueChange>
</DynamicDataFields>
</GlobalDynamicData>
Yes,  as you can see the XML  was created  with the same  "DynamicDataField" and "DataField"  for all information data.  (There is 4 pages of data with the same structure) I am confused and I dont know how to create the ActionScript to pull this data in my .swf    The only way I know how to dynamically populate text fields using XML and actionscript  is the code below:
My action script-------->
my xml document is called: CMS_GD_AlertData.xml
<XML>
      <ConfigureItems>
<ConfigureItems>
<owner_name> example</owner_name>
<steve_name>  example2   </steve_name>
<jack_name>   example3   </jack_name>
<ken_name>   example4   </ken_name>
<AlertVicOther> example 5</AlertVicOther>
Then my instance name for the dynamic text box is called: ownerName_txt, steve_txt, jack_text......  (etc)
var myXML:XML = new XML();
var XML_URL:String = "CMS_GD_AlertData.xml";
var myXMLURL:URLRequest = new URLRequest(XML_URL);
var myLoader:URLLoader = new URLLoader(myXMLURL);
myLoader.addEventListener("complete", xmlLoaded);
function xmlLoaded(event:Event):void {
    myXML = XML(myLoader.data);
var xmlDoc:XMLDocument = new XMLDocument();
    xmlDoc.ignoreWhite = true;
    var menuXML:XML = XML(myLoader.data);
    xmlDoc.parseXML(menuXML.toXMLString());
for each (var ConfigItems:XML in myXML..ConfigureItems) {
        // Set the external values into local vars for simpler script use below
    var ownerName:String = ConfigItems.owner_name.toString();
var steveName:String = ConfigItems.steve_name.toString();
var jackName:String = ConfigItems.jack_name.toString();
var AlertVicOther:String = ConfigItems.AlertVicOther.toString();
    var bgColor:String = ConfigItems.background_color.toString();
    var bgSize:Number = ConfigItems.background_size.toString();
        // And apply those variables now to the stage elements or whatever the use
    ownerName_txt.text = ownerName;
steve_txt.text = steveName;
jack_text.text = jackName;
message_text.text = AlertVicOther;
    myBG.width = bgSize;
    myBG.height = bgSize;
        myBG.gotoAndStop(bgColor);
which works fine, 
My question to everyone is How do tell flash to pull specific dynamic data if all the datafields are exactly the same... I would think all data fields that are named have to be diffrent  so when you script the code you are telling flash to go to that data source and pull from that record.  if you have the same naming convention how does flash know which one to pull from if they all have the same name..
Please help.
thank you

Try to work thru the tutorial linked below, and maybe you can gain some insight as to how to deal with an xml structure that has multiple sets of data.
http://www.gotoandlearn.com/play.php?id=64

Similar Messages

  • Loading Flash AS3/XML into Flex 3

    I'm seriously at a loss.
    I'm loading a Flash AS3 SWF into Flex via SWFloader and it
    will not load the xml data the file normally loads. The Flash file
    is fairly basic and loads XML data from a local file.
    I've tried all sorts of scoping within the Flash file
    pointing to the xml file just in case but still nothing. What do I
    need to do to get this file to read the XML through Flex 3?
    <mx:SWFLoader x="9" y="14" width="140" height="90"
    source="swfs/sponsors/top_sponsors.swf"/>
    The xml file is in the same directory.

    The migration of this file to proper AS3 is brutal. It would
    be easier to just rewrite the whole thing in flex. Screw it.

  • Flash/AS3/XML - not loading after XML edits

    HI all,
    I apologize in advance for not being able to give a lot of information. I'm working with a proprietary template for e-learning and trying to get it to work. But, regardless, here's the situation.
    Building e-learning using a Flash and AS3 template that has several parts and relies on one XML file for all content. There is an index (Flash) page that serves as the shell for the entire module. That index page 'hosts' a language selection menu, main menu, and the stage for .swf files that are 'pages' of each chapter. Each 'page' has several 'clips' inside of it (images, text, audio, etc.).
    The XML is structured as such (N = number of items total, X = specific number of that item):
    <xml>
         <course (with title and several other attributes)>
              <chapter type="chapter" title="Title of Chapter">
                   <page>
                        <file><![CDATA[pagedirectory/pageX...N.swf]]></file>
                        <clipX1...N audio='audiodirectory/audio_X...N'> <![CDATA[If there is any on-screen text, this is where it goes.]]></clipX...N>
                        <ccX...N><![CDATA[This is for the closed captioning; all script/audio text is here.]]></ccX...N>
                   </page>
              </chapter>
    etc. for as many chapters as there are.
    The XML file structure is a little odd, but it works...usually. For some reason though, I broke it.
    I put in "chapter 0" which is the introduction. Everything runs smoothly, but then when I add another chapter, the main menu won't load. I assumed this to be something in my XML syntax; however, I've checked over it, including the new stuff I added. BTW: The main menu is populated by the "Chapter" attributes in the XML.
    So, I guess my question is two-fold, and I understand that I may only get very general answers (or questions that relate to specifics):
    Are there things in XML files that when used by AS/Flash simply don't work? I've already checked for "&" and other characters... but are there some other ones?
    Any other guesses as to why the main menu loads when only one chapter is in the XML, but not when there are two? Again, I've check for tag accuracy, etc. What could I be missing though?
    Thanks!
    Andy

    Update. Flash preview gives me this error:
    "TypeError: Error #1085: The element type "cc5" must be terminated by the matching end-tag "</cc5>"."
    I have checked all "cc5" tags in the XML and all are closed by </cc5> ... ?
    AS

  • How to edit bitmap which is imported in flash using xml and save the edited bitmap back to xml in flash.

    hi all
    It would be appreciated if any one let me know how to edit
    bitmap which is imported in flash using xml and save the edited
    bitmap back to xml in flash.
    Is it posible to save the bitmap data in flash?
    thanks in advance

    Yes you can... but like I said before you need to upload the
    data from the changes you make to a server.
    In terms of the solution... its unlikely that you'll find one
    specifically for your needs. You will have to learn whatever you
    don't know how already and maybe adapt some existing examples to
    your needs.
    To change the visual state of a movie clip... you just do all
    the regular things that you want to do to it using flash... scale,
    rotation, drawing API , textfields etc in actionscript. If you
    don't know how to how to do that stuff, then you need to learn that
    first. That's basic actionscript.
    You can capture the visual state of a movieclip using the
    BitmapData class. That includes a loaded jpeg. You can also
    manipulate bimatp data using the same class. You should read up on
    that if you don't know how to use it or check out the examples
    below for uploading info.
    For uploading to the server:
    Here's an as2 solution that took 15 secs to find using
    google:
    http://www.quasimondo.com/archives/000645.php
    If you're using as3, google search for "jpeg encoder as3" and
    look through that info. There are also historical answers in the
    forums here related to this type of thing that might help as
    well.

  • Anyone have a good tutorial for an AS3-XML image gallery?

    I'm a pretty good Flash developer, but I've never worked with XML in Flash.  I'm looking for a good tutorial on creating an XML driven image gallery, but I have yet to really find anything.  Does anyone out there have a good tutorial?  Thanks!
    Jesse

    Your best bets for getting something more specific to your needs will either be to...
    - search Google using terms like "AS3 XML gallery tutorial" and "AS3 XML slideshow tutorial"
    - take one fairly complicated tutorial and learn how it works down to understanding each element of what is being done.  Once you a proper level of understanding you should be able to reason out how to create one of your own with whatever different features you prefer

  • How to link pdf file in flash by xml ??

    how to link pdf file in flash by xml ??

    try to give <a href="your address">My Pdf</a>
    and your textfield should be html enabled
    mytextField.html=true
    mytextField.htmlText=your xml text

  • Flash Lite XML Driven Gallery Simple Question

    Hello Flash Lite Gurus',
    Someone Named "Mr. Samir K. Dash;" did a wonderful tutorial regarding Flash Lite XML driven Photo Gallery, and I have just a small question:
    1> I changed the attributes schema of the xml as attached and noticed that it is not working, and I wonder what could be the reason (please see the attached XML new attribute schema, I didn't change fields names, I just changed the way the attributes' schema looks like).
    The link to the tutorial is the following:
    http://www.adobe.com/devnet/devices/articles/xml_photo_gallery.html
    Looking forward to your help
    best regards
    Talal

    As I look at your modified XML file, you need to make major changes in the script.
    You have changed the attributes to become child nodes. So, you will need to use firstChild.nodeValue or childNodes[i].nodeValue everywhere.
    Regards,
    Hemanth Sharma
    http://www.flashlitehub.com/blog

  • Other problems with loading Captivate files into Flash AS3 project

    I have a Captivate file done with Captivate 3, published to
    Flash player 9 that is being loaded into Flash AS3. The captivate
    is a simple recording of some mouse clicks in a browser. I am
    displaying the playbar along the bottom, and its buttons all work
    fine except for the progress bar, where you can drag the knob and
    scrub back & forth in your presentation.
    This progress bar is not working as it should. I see the
    mouse cursor change to a hand, but when I click I cannot drag the
    knob to control the progress bar. The other buttons in the playbar
    do work (replay, pause, play, back, forward).
    This is a unique problem in that it is only happening when
    viewed in IE (7) when loaded into my Flash AS3 project. When viewed
    in Firefox in my project, or as a standalone SWF, or as a SWF
    simply embedded onto a plain HTML page, it works just fine.
    Does anybody have any insight?
    Another thing I notice with loading Captivate files with AS3
    is the the amount of output messages it displays. Rather annoying
    (unless this is a "feature" I've yet to be aware of - heh)

    Hi,
    I know exactly how you feel, there is simple answer; replace
    Captivate for Camtasia Studio 5 at techsmith.com. The weight on
    those shoulders will be gone! You'll smile more, be more
    socialable. One Happy Person.
    I am very happy person ;)
    Kind Regards,
    Boxing Boom

  • Flash and XML help : (

    Hi all
    bit of a newbie, so probably quite easy if you know how:eek:
    would anyone beable to help with sorting out an XML file, what I have is a tooltip that loads in via XML and exported from flash. the XML loads in 2 text fields,  field and field2.
    what I am trying to do is add a button also to the tooltip so that you can click and go to a url.
    would anyone beable to help with this.
    this is what I have in my XML file;
    <?xml version="1.0" encoding="utf-8"?>
    <data>
        <image name="image 1" path="img/img1.jpg"
        title="Food Fight"
        text="Information here!" />
    </data>
    this loads in 2 text fields.
    this is what I have in my AS;
                  var tooltip:ToolTip = new ToolTip();
          //tooltip.buttonMode = false; 
                    tooltip.field.text = titles;//loads tooltip 1
                    tooltip.field2.text = texts;//loads tool tip 2
                    holder.addChild(tooltip);
    I thought I could do something like this but I seem to be getting errors
    XML
    <?xml version="1.0" encoding="utf-8"?>
    <data>
        <image name="image 1" path="img/img1.jpg"
        title="Food Fight"
        text="Information here!"
                 button="click to view/>
    </data>
    and in my AS
    var tooltip:ToolTip = new ToolTip();
                    //tooltip.buttonMode = false; 
                    tooltip.field.text = titles;//loads tooltip 1
                    tooltip.field2.text = texts;//loads tool tip 2
                    tooltip.field3.text = buttons;//loads tool tip 3
                    holder.addChild(tooltip);
    but just not working, what am I doing wrong:yikes:
    many thanks for any help!

    hi Saransoft
    thanks for that, thats great, yes it seesm to work I now have an extra text field with the menu that is the button, I have put my XML like this, is it correct
    <image name="image 2" path="img/img2.jpg"
      title="Jazz Time"
      text="Information"
      button="Click for URL"  />   //NEW THAT I ADDED FOR THE BUTTON IS THIS CORRECT?
    Now that I have another text for the button my final thing is getting it to be click able and go to a URL when you the text button is clicked. can I do this just in the XML file or is there also more to be added to the AS...aaaaaaaaaaaaarrrrrrrrghhhhh!!!!
    many thanks for your help??

  • How to load html page or website in flash as3

    hi
    how to load html page or web link (www.google.com)  in flash as3.
    please help me...

    Use the navigateToURL function...
    var url:String = "http://www.wherever.com";:
    var req:URLRequest = new URLRequest(url);
    navigateToURL(req);
    OR in one line...
    navugateToURL(new URLRequest("http://www.wherever.com"));

  • Controlling External Captivate 5 swf using flash AS3

    Hi,
    I have created a basic Flash AS3 interface in which I am trying to control the navigation (next slide / previous slide) of an external captivate 5 swf which I have added using a loader, but i cant work out the solution.
    My code is currently as follows:
    import flash.net.URLRequest;
    var Xpos: Number = 96
    var Ypos: Number = 94
    var my_loader:Loader = new Loader();
    my_loader.load(new URLRequest("content.swf"));
    my_loader.x = Xpos;
    my_loader.y = Ypos;
    addChild(my_loader);
    stop();
    nextBut.addEventListener(MouseEvent.MOUSE_UP,gotonextframe);
    function gotonextframe(event:MouseEvent){
    MovieClip(my_loader.content).rdcmndNextSlide();
    Any help would be much appreciated,
    thanks
    Dez

    Thats perfect, thanks for the reply, much appreciated!
    I guess you have tried:
    rdcmndRewindAndStop
    Set to 1 to rewind and stop the project.

  • How to get this PHP list in Flash AS3?

    Hi,
    I have the following PHP code (downloaded from net) which builds a list of all the files in a "MyPics" folders:
    PS php can build a list of all the files in a folder so you don't have to type them all out like that, plus it makes updating a sinch all you have to do is put a pic in the folder and it will be added to the list.
    PHP Code:
    <CODE>
    <?
    //this function goes through the defined directory and makes a list of all the files
    function parse_dir($dir,$level){
        $dp=opendir($dir); //opens the directory for reading
        while (false!=($file=readdir($dp))){  //runs until no more files
            if ($file!="." && $file!=".." && $file!=".htaccess"){  //so you don't get all the default folders
                $countervar=$countervar+1;  //just a counter for numbering the path names
                if (is_dir($dir."/".$file)) parse_dir  //recurses the subdirectories
    ($dir."/".$file,$level+1);
                else print "&path".$countervar."=".$dir."/".$file;  //pieces together something flash can read
    $start_dir="pathToMyPics";  //put the name of the folder with all the pics here
    $level=1;
    parse_dir($start_dir,$level);
    ?>
    <CODE/>
    The above php will output something like this
    &path1=pathToMyPics/pic1.jpg&path2=pathToMyPics/wowWhatAWierdPicName.jpg
    call the php in flash( loadVariables("fileListPHP.php") ) and viola you get easy to use paths to all you pictures.
    I am not able to understand the code to write on FLASH AS3 frame. Please help.
    Thanks.

    In AS3 you want to use the URLVariables class.  Search Google using "AS3 URLVariables tutorial" and you should find what you need to get going.  Here's one result from that search...
    http://www.metah.ch/blog/2008/01/using-urlvariables/

  • Convert Flash AS3 to JAVA .Jar-file?

    Hello All,
    in the old old version of Director, you could export a .JAR
    file from your project. If you stayed within the programming that
    the exporter supported.
    I wonder, as I have seen some "Java to Flash as3"-converters,
    if anything is out there for the opposite?
    Cause I need something to make a JAR file for some simple
    functionality in JAVA, and I thought Flash could aid me..?

    Can someone answer?

  • Create a toc from adobe flash as3?

    hi guys
    i wante to create a completely toc in adobe flash as3? is there any way to do this?
    for example i want to create a toc file with full size logo (photo form toc information)
    or change duration location with slide title
    i want also another questiion about sdk folder in adobe captivate, i found some swc file in this folder, but i want documetion to use this swf file in custome development,
    thank

    Hi
    Please elaborate a bit more as you want users to download pdf from your site or print site page as pdf etc
    If its regarding documents then you can add add df documents in your site and then link them to pages where users can download the pdf, if you are referring to print page then you can provide information for ctrl+p/cmd+p , or add html code for print shortcut.
    https://forums.adobe.com/message/6319543
    Thanks,
    Sanjit

  • Flash as3 code in Cap 7

    I would like to add a flash AS3 movie and buttons in my Cap project that would goto certian slides. I've looked everywhere to find  some code that would help me on my way, but no luck. Can anyone here help?
    THanks

    If you create a new widget in Captivate it will supply with the code to access Captivate. This should get you there.
    http://www.infosemantics.com.au/widgetking/category/captivate-variables/

Maybe you are looking for

  • When a+b+c is not equal to a+c+b

    Hi, I would be pleased to have some comment on the following : if a+b+c != a+c+b then something the + operator is not working as it should !? SQL> select a,b,c,a+b+c,a+c+b from (select date '2005-02-28' a, numtoyminterval(1,'MONTH') b, numtodsinterva

  • Oracle 10g Patch Set Rollup Bundle

    Hi Guys... Where can I find this file p7612639_10204_Solaris-64_rollup_bundle_no3.zip? I searched on metalink without success. Please guys you will pardon me I posted this under the pl/sql forum by mistake so it might appear as if it is a duplicate.

  • I need help on matrix

    hi all, i started in develop a new form and i need to put matrix in on the form so i used B1n ,now what is the code for choose from list column and check box column .

  • Oracle 10g AS configuration file tutorial

    Is there any site from where I can get tutorial about oracle 10g AS configuration file? I have to modify the configuration file according to my application need.

  • XID - Replace Local User to Domain\User

    Hi All. We have to change local SAPServiceXID User to Domain\SAPServiceXID User boths users are administrators into the Administrator Group. If we start the three central instances(Database,Abap,JAVA) with local User there is no problem. when we repl