Faced with AS3 XML

Hello

I'm trying to understand the new AS3 xml structure.  I know that I can use the XMLdocument class and go back to the old way of doing thinsg but I don't want to do that, if I can help it.

So I have an AS3 Air application that is successfully read and write to an XML file.  Now, I want to replace a whole node or an attribute if it is easier, but I can't understand how to target.

If the XML starts with a blank node:

< info > < / info >

and I add to the nodes that take the following form:

< comment >

< name > name < / name >

< number > < / number >

< time > some value < / time >

status <>status < / status >

< / guests >

What I want to know is how to target the State node (or indeed any other node) so that I can replace the attribute she or he is.  So, let's say I have a bunch of these nodes of comments and I want to change the status for the first, how do I do this using the new syntax.

I'd appreciate any help you can give.

Best regards

Chris McLaughlin

If there is only one node comments:

yourxmlinstance. Guest.Status

If you have several nodes of comments, you can use array notation to indicate which node comments:

yourxmlinstance. Guest [0]. Status

Tags: Adobe Animate

Similar Questions

  • Create an XML with AS3 object

    I want to create an XML object based in AS3, but don't know how to do this.

    I first tried to create a string that represents my XML elements and their values, but then I don't know how to convert this string into an XML object.

    Secondly, in my view, there are other ways to create XML objects in AS without doing anything with strings.

    Can someone please recommend a way to do this?

    An example XML to create with AS3 is:

    I got the solution to my problem. For anyone interested, see me the code below (the names of xml elements are different, but the concept is the same).

  • Parental and child control with AS3

    Hello

    I am new to AS3 and although I can see some good practices and functionality, I'm constantly stuck and can still do the things I would do if easily with AS2 - I almost it relearn from scratch!. I would still appreciate little help and advice on this...

    I did a class that creates a "sort" menu with data from an XML file, and basically is what he does when he is called to create an emptyMC (a container), add a childMC (a square) and add another child (a text label). When I create the container, I am trying to add a MouseEvent that can act on each instance of container, but all I can get is a MouseEvent on the object that contains all the MCs added. The code follows.

    Can someone enlight me with that issue or explain what I am doing wrong.

    I do not understand the parental dynamics with AS3 and the absence of the use of instance names and parenting dot does not help.

    Thanks in advance.

    Note to Adobe: previous versions of Flash and as a reference Help files were far more useful than in CS4!

    In the timeline:

    Import assets.myDynMenu;

    var theMenu:myDynMenu = new myDynMenu ("menu.xml");
    stage.addChild (theMenu)

    Stop();

    In the class:

    package assets

    {

    import flash.display. *;
    import flash.events.Event;
    import flash.events.MouseEvent;
    import flash.text.TextField;
    flash.net import. *;

    public class myDynMenu extends Sprite {}

    LOADING EXTERNAL INIT DATA

    public void myDynMenu (theData) {}

    LOADS MENU DATA FROM PREFORMATTED XML
    var loader: URLLoader = new URLLoader();
    var url: URLRequest = new URLRequest (theData);
    loader.addEventListener (Event.COMPLETE, buildTheMenu);
    Loader.Load (URL);
    }

    FULL CHECK LOAD XML MENU DATA - OBJECT BUILDING AND CHILDREN

    public void buildTheMenu(event:Event):void {}

    var xml = new XML (event.target.data);

    for (var i = 0; I < xml.menuData.menuItem.length (); i ++) {}

    ADDS A CONTAINER

    var itemContainer:MovieClip = new MovieClip();
    itemContainer.name = "menu" + i;
    //

    THE NEXT LINE IS NOT DO WHAT I WANTED?
    IN THE FUNCTION BEING CALLED, I NEED TO CONTROL THIS ELEMENT AND ITS CHILDREN

    itemContainer.addEventListener (MouseEvent.MOUSE_OVER, onMouseOver);

    //

    itemContainer.x = 100 * i;
    itemContainer.y = 0;
    itemContainer.mouseEnabled = true;
    itemContainer.mouseChildren = false;
    addChild (itemContainer);

    ADDS A CHILD OF CONTAINER (a square)

    var itemBase:MovieClip = new MovieClip();
    itemBase.graphics.beginFill (xml.menuData.mConfig.mainItemColor);
    itemBase.graphics.drawRect (0,0,xml.menuData.mConfig.mainItemW,xml.menuData.mConfig.mainIt emH);
    itemBase.graphics.endFill ();
    itemBase.name = "basic" + i;
    itemBase.mouseEnabled = false;
    itemBase.mouseChildren = false;
    itemContainer.addChild (itemBase);

    ADDS a CHILD OTHER to CONTAINER (a text label)

    var theLabel:TextField = new TextField();
    theLabel.x = 5;
    theLabel.y = 5;
    theLabel.selectable = false;
    theLabel.mouseEnabled = false;
    theLabel.border = true;
    theLabel.text = xml.menuData.menuItem [i] .mName;
    itemContainer.addChild (theLabel);

    }

    }

    It IS THE MOUSE ON WHICH I NEED law to EACH itemContainer (AND CHILDREN)
    private void onMouseOver(event:MouseEvent):void {}

    event.stopPropagation ();
    trace ("you're on" + myIdName);
    }


    }

    }

    use:

    package assets

    {

    import flash.display. *;
    import flash.events.Event;
    import flash.events.MouseEvent;
    import flash.text.TextField;
    flash.net import. *;

    public class myDynMenu extends Sprite {}

    LOADING EXTERNAL INIT DATA

    public void myDynMenu (theData) {}

    LOADS MENU DATA FROM PREFORMATTED XML


    var loader: URLLoader = new URLLoader();
    var url: URLRequest = new URLRequest (theData);
    loader.addEventListener (Event.COMPLETE, buildTheMenu);
    Loader.Load (URL);
    }

    FULL CHECK LOAD XML MENU DATA - OBJECT BUILDING AND CHILDREN

    public void buildTheMenu(event:Event):void {}

    var xml = new XML (event.target.data);

    for (var i = 0; i)

    ADDS A CONTAINER

    var itemContainer:MovieClip = new MovieClip();
    itemContainer.name = "menu" + i;
    //

    THE NEXT LINE IS NOT DO WHAT I WANTED?
    IN THE FUNCTION BEING CALLED, I NEED TO CONTROL THIS ELEMENT AND ITS CHILDREN

    itemContainer.addEventListener (MouseEvent.MOUSE_OVER, onMouseOver);

    //

    itemContainer.x = 100 * i;
    itemContainer.y = 0;
    itemContainer.mouseEnabled = true;
    itemContainer.mouseChildren = false;
    addChild (itemContainer);

    ADDS A CHILD OF CONTAINER (a square)

    var itemBase:MovieClip = new MovieClip();
    itemBase.graphics.beginFill (xml.menuData.mConfig.mainItemColor);
    itemBase.graphics.drawRect (0,0,xml.menuData.mConfig.mainItemW,xml.menuData.mCon fig.mainItemH);
    itemBase.graphics.endFill ();
    itemBase.name = "basic" + i;
    itemBase.mouseEnabled = false;
    itemBase.mouseChildren = false;
    itemContainer.addChild (itemBase);

    ADDS a CHILD OTHER to CONTAINER (a text label)

    var theLabel:TextField = new TextField();
    theLabel.x = 5;
    theLabel.y = 5;
    theLabel.selectable = false;
    theLabel.mouseEnabled = false;
    theLabel.border = true;
    theLabel.text = xml.menuData.menuItem [i] .mName;
    itemContainer.addChild (theLabel);

    }
      
    }

    It IS THE MOUSE ON WHICH I NEED law to EACH itemContainer (AND CHILDREN)
    private void onMouseOver(event:MouseEvent):void {}

    event.stopPropagation ();
             trace ("you're on" + event.currentTarget.name);
    }

    }

    }

  • Verizon said I can be faced with one problem with my browser and don't charge but ATT, gmail and other

    Tried loading Verizon homepage, but it says I can be faced with a problem with my browser. ATT, gmail between other fine load and Verizon was very well for some time now, what should I do? I'm not tech savvy so please keep it simple for me, thank you.

    Try to clear your browser's cache.

    Firefox button or tools > clear recent history... - details and of course Cache hit only is selected, and then select all and click the clear now button.

  • Faced with a failure of OSD task sequence. The failure messages in the end are: failure to file WIM mount (0 x 80070002) & Failed to create media (0 x 80070002)

    Hello

    Faced with a failure of OSD task sequence.

    The failure messages in the end are:

    --------------------------------------------------

    Has no file WIM mount 0 x 80070002

    Cannot create media 0 x 80070002

    CreatTSMedia failed with error 0 x 80070002 details MediaGenerator

    --------------------------------------------------------------------------------------------

    It comes via SCCM 2007 R3 and a version of Windows XP.

    I think 0 x 80070002 means "the system cannot find the file specified."

    But what file?

    How do you determine what the media Wizard is missing to generate this error?

    Is this a driver problem?

    Thank you

    John

    Hello

    The question you posted would be better suited in the TechNet Forums. I would recommend posting your query in the TechNet Forums. You can follow the link to your question:

    http://social.technet.Microsoft.com/forums/en/configmgrosd/threads

    Hope this information helps.

  • faced with the front camera

    When the superior auto mode, you can not use hdr for the rear camera. But faced with the camera before the automatic mode allows you to choose hdr in the settings. Is this a bug problem or software?

    This isn't a bug. Unfortunately, the HDR is not available in this mode. If you want to use HDR for the rear camera, you must use the manual mode.

  • Win 7. I'm faced with a problem that is when I'm with system after that somw time system stops unexpectedly.

    I have Win 7. I'm faced with a problem that is when I'm with system after that somw time system stops unexpectedly. What can I do?

    If the system stops just without error message, the most likely cause is a CPU overheating. Thermal sensor of the card from the mother to the title of the CPU stops the system to protect the CPU.

    Check that the CPU fan is running and remove any fan of mast betwenn the CPU of dust and the fins of the cooler.

  • problems with the XML that is returned when you call a web service with CF11

    Hi, I ran into an unusual behavior when calling web services.

    I call a web service that returns an XML like this:

    < children >

    < child >

    John < firstname > < / name >

    DOE < name > < / lastname >

    < / child >

    < / children >

    during the call to the web service of CF10, it works fine. However, when the CF11, I don't get this:

    < child >

    John < firstname > < / name >

    DOE < name > < / lastname >

    < / child >


    no < child >? for some reason, CF11 ignores / hides the highest level XML. This does not happen on previous versions. Why? the server that hosts the web service's CF11 too.

    Report it as a bug in Coldfusion. In any case, I recommend making sure your web service returns a string, not an XML object.

    This is because a web service must be universal. Appellants to .NET, Java, PHP, ASP and so on, will interpret a chain exactly the same way. Whereas an object XML Coldfusion is a construction that is heard only in CFML.

    Your return string should also start with the XML declaration, like this

    John

    DOE

    So it is clear to the appellant in which brought the cat.

  • How to read the data with different XML schemas within the unique connection?

    • I have Oracle database 11g
    • I access it via JDBC: Slim, version 11.2.0.3, same as xdb.
    • I have several tables, each has an XMLType column, all based on patterns.
    • There are three XML schemas different registered in the DB
    • Maybe I need to read the XML data in multiple tables.
    • If all the XMLTypes have the same XML schema, there is no problem,
    • If patterns are different, the second reading will throw BindXMLException.
    • If I reset the connection between the readings of the XMLType column with different schemas, it works.

    The question is: How can I configure the driver, or the connection to be able to read the data with different XML schemas without resetting the connection (which is expensive).

    Code to get data from XMLType is the implementation of case study:

     1   ResultSet resultSet = statement.executeQuery( sql ) ; 
    2   String result = null ;
    3    while(resultSet.next()) {
    4   SQLXML sqlxml = resultSet.getSQLXML(1) ;
    5   result = sqlxml.getString() ;
    6   sqlxml.free();
    7   }
    8   resultSet.close();
    9    return result ;

    It turns out, that I needed to serialize the XML on the server and read it as BLOB. Like this:

     1    final Statement statement = connection.createStatement() ;  2    final String sql = String.format("select xmlserialize(content xml_content_column as blob encoding 'UTF-8') from %s where key='%s'", table, key ) ;  3   ResultSet resultSet = statement.executeQuery( sql ) ;  4   String result = null ;  5    while(resultSet.next()) {  6   Blob blob = resultSet.getBlob( 1 );  7   InputStream inputStream = blob.getBinaryStream();  8   result = new Scanner( inputStream ).useDelimiter( "\\A" ).next();  9   inputStream.close(); 10   blob.free(); 11   } 12   resultSet.close(); 13   statement.close(); 14  15   System.out.println( result ); 16    return result ; 17
    

    Then it works. Still, can't get it work with XMLType in resultset. On the customer XML unwrapping explodes trying to pass to another XML schema. JDBC/XDB problem?

  • A simple way to load a pdf page into flash with as3

    Hallo,

    is there a simple way to load a pdf page into flash with as3 at Flash.

    I mean no plug in or as a class.

    Thank you.

    If it is an air application, you can use the htmlLoader.

    Otherwise, you can use navigateToURL but that only opens 'in' your swf, and you cannot manipulate the PDF with actionscript.

  • I am faced with a task.

    I am faced with a task - need to get rid of him.

    I have successfully used the 3D camera and followed all the points, selected three points thanks to a target, put a blanket on the task, adjusted to the right size with point angle etc..  When I test the clip the dressing does not follow the movement of the person. Original camera is on a tripod.  The movement of the person is minimal - moving from one foot to the other.  There's a Kubota moving in the background.

    If I could photoshop every image I want.  It would be easier.  The short clip is long 1m09sec.

    Any advice out there?  I worked three days straight on tutorials trying to figure out what I'm doing wrong, nothing helps.

    Thank you.

    If the object/person moves, the 3D camera Tracker isn't the right tool for the job. It's for when the movement in the scene is entirely because of the camera.

    If you are tracking just a spot and trying to blur, and then draw a mask around the task, use the tracker mask to follow the mask and use a mask effect to limit the effect to inside of the mask.

    Or using mocha.

    Or use point tracker.

  • is it possible to make a timer with AS3, which is accurate to a millisecond.

    I am new to AS3. I have somehow developed an auditory and Visual reaction timer taking the script from here and elsewhere. I know that his is not accurate and I also know that I'll write it correctly when I heard the script carefully.

    But I was checking the net about the timer class and various positions on this issue and I am annoyed by a question "if its possible to make a precise timer with AS3?" can someone please tell me with certainty. and I will be grateful if I know how to do it properly. I can post the code I wrote (assembled).

    the answer is, maybe. but for most of the coders, the answer is, no.

    getTimer() is accurate to 1ms.  but to determine the elapsed time / and don't call or to run code on a timed basis. It can be used with the Timer class events or enterframe to do certain things with precision.

    However, the timer class is not accurate in the way of thinking of beginning coders.  It will be, on average, to allow the call of a function near the designated interval so there is no performance problem with your swf file.  It does not allow each function call to occur at regular intervals.

  • Adjust the order of the layers with AS3

    I want to load an external SWF into my project. I do this by adding a charger to the scene. It seems above all, there are 16 layers in my FLA, and I want to put it between the second and the third to the lower layers. How can I do this? I looked at some things online but they are all to change the order of objects on the same layer, and they usually invole do 2 or three objects with AS3 then change the order on the same layer, always above the objects that are actually on the stage of the FLA. I want to put the SWF loaded under Of OBJECTS ALREADY EXISTING that are on different layers.

    My code:

    var pageLoader:Loader = new Loader;

    addChild (pageLoader);

    pageLoader.x = 98;

    pageLoader.y = 121;

    pageLoader.z <-as far as I know it works in a single layer, it won't jump from layer to layer.

    Some have suggested to load my swf in a clip from movie ampty bt when I do this I lose interactivity for swf file, why is this and is there away around this?

    My code:

    var pageLoader:Loader = new Loader;

    pageContainer.addChild (pageLoader);

    pageContainer is an empty movie clip

    I want to load directly to the scene and just change the layer (first method), but if this cannot be done so I need a way to get SWFs loaded into a clip vacuum film and keep their own interactive.

    I dound in connection addChildAt, which is different from addChild, because it has 2 parameters, the name of the object and its z-index. So I was able to do:

    addChildAt(pageLoader,4);

    Then I met the same problem with movie clip method is empty, I lost interactivity. Then I noticed that there movieclips above because one of them is used as a blending mode by covering it. So, I realized that the empty movie clip method did not work because there are video clips above it. So I did mouseEnabled = false. And it works, so YAY!

  • Image tag with the XML tag

    Hi all

    I want to mark all my images embedded in a CS6 document with an XML tag. I use CS6 on Windows with JavaScript. Any advice would be appreciated. Thank you.

    Rick

    OK, it seems I have to add the element to the structure, and then use "tagging" to apply the item to my image.

    // Get the selected image.
    var image = app.selection[0].getElements()[0];
    // Get the Story element.
    var root = doc.xmlElements.item(0);
    var storyElem = root.xmlElements.item(0);
    // Add the "Image" element to the Story element.
    var imageElem = storyElem.xmlElements.add ("Image");
    // Tag the selected image with the Image tag.
    image.markup (imageElem);
    
  • Change the text with AS3 makes the invisible text

    Hi all

    Even for a total n00b like me, this is awkward: I can't even change a text on the stage with as3.

    I place a text on my stage, assign the dynamics, incorporate the police and give it an instance name. When I change the text, he evacuated the scene or if it remains invisible, I don't know.

    I thought it would be as simple as this: myText.text = "new text";   but apparently I am doing something wrong. When I put a trace (myText.text);  before and after, I see the old and the new text in the output window. Then he changes correctly, but why he disappears it? Also tried in a new white project, to ensure that it was not something somewhere.

    I'm totally distraught...

    BTW I use Flash CS5.5 on Win7

    do not enter text in the ide.  Use actionscript to assign the original text of your textfield and also change.

Maybe you are looking for

  • Why he will not open a second time

    I have a small window with something on chrome. I'm on windows 8.1

  • [Beginner] Boolean lights do not Flash "separately".

    I have attached a picture of a part of my code 2 buttons on the left (conditions 1 and 2 of the Statute) Other sections control the digital part, when I the value 3, the LED (alarm 1/2) will Flash every 250ms, when set to 2, I want it flashes every 1

  • DirectX can it be cancelled free of charge installs or by using the system restore

    Running Windows 7 Pro, I know that many people here have a problem with games crashing to the desktop on startup, Bad company 2, battlefield 2, world at war cod. much of this is due to having directx 10, or a more recent version, most of them want to

  • Aspire audio crackles V7

    Hey guys someone noticed that with the increase in volume or watch videos on his youtube is crackling randomly? Even if I go with the cursor in the Panel c realtek I hear slight crask bottom left speaker and little less right on lower speaker I tried

  • Why Windows 7 connect to Bose AE2W even if it is coupled?

    Successfully added Bose AE2W and appears in the list of devices Bluetooth in Windows 7. Clicked on the icon of Bose AE2W which opened the Bluetooth Device Control screen. Click the button to connect. Message indicating the configuration of the Blueto