AS3.0 iteration in XML file

I am new to AS3.0 and the new way of use of XML E4X. I'm trying to loop through a portion of a loaded external XML file and display the results. Here's some of my XML file:
< approval id = "1" >
< title > The Gate House < /title >
< feature > majestic two levels Preserve Neighborhood Amenity Center < / fiction >
< element > beautiful gardens and trails meandering < / fiction >
< feature > activity room meeting, theater room, Gourmet kitchen, fireplace, large fireplace < / fiction >
< element > terraces and Patios < / fiction >
< feature > available to residents for parties, meetings, weddings and meetings < / fiction >
< / certification >

Are both of the other equipment. When a user clicks on a button, I would like to enumerate all the features of this particular equipment. Here is my code for this (the code associated with the listener for the button):

function btnClick (eventObject) {}
var mc:MovieClip = eventObject.target
var num:String = mc.name.replace("btn","")
var xmlAmenity:XMLList = myXML.amenity. (@id is num)
for each {(var prop: XML dans xmlAmenity)}
trace (prop.feature);
}
}
Basically, the button that calls this is btn1, then the variable num ends up being 1. myXML is a global variable in which the external XML file has already been loaded. It then uses the variable num to award accreditation with an id if 1 to the variable xmlAmenity as an XMLList. Everything works just great except for the fact that the trace of the product the following:
< feature > majestic two levels Preserve Neighborhood Amenity Center < / fiction >
< element > beautiful gardens and trails meandering < / fiction >
< feature > activity room meeting, theater room, Gourmet kitchen, fireplace, large fireplace < / fiction >
< element > terraces and Patios < / fiction >
< feature > available to residents for parties, meetings, weddings and meetings < / fiction >

I don't want the tags, what is inside of them. Is there a property, that I need to use (something like prop.feature.contents) or I go about it the wrong way entirely? I guess I could restructure my XML file to the content of the tag feature in an attribute named description and then draw the attribute with prop.feature.@description, but, I would like to know how to access the text inside the opening and closing tag. If I have direct access (something like myXML.amenity. (@id () == num) .feature [0]) so it works very well, I can't seem to figure out in a loop. I guess I could increment a variable and do something like trace (myXML.amenity. (@id () == num) .feature [x]), but there must be a better way.

Goodness sakes, it was a long post for a quick response, I got it:
My loop should read as follows:
for each {(var prop: String en xmlAmenity.feature)}
trace (n.m);
}

The key was enumeration in each xmlAmenity.feature, not xmlAmenity. Of course, if there is a better way, I'd buy some...

Tags: Adobe Animate

Similar Questions

  • Problem loading an xml file if not placed locally.

    Hey!

    I started a discussion on my capture setting problem and I now reduced it now. It turns out it wasn't settings do not have caught. The swf file takes the fine settings, so this apparently isn't the issue. My problem is that it seems that the file won't loaded .xml. When I have my .xml and .swf file locally on my computer and it works, it works very well. When I place it on my web server the same way, it works fine. However, when someone puts my .swf in embedded on their Web site that the XML will not be loaded by the SWF for a reason any. Here's the AS3 code, load the xml file. He was works well all the way until I started playing with the call of the swf from different sources (web server of my friend in the integrating etc.).

    -loading of the external xml file.

    var urlRequest:URLRequest = new URLRequest ("http://www.website.com/folder/myfile.xml");

    var urlLoader:URLLoader = new URLLoader();

    var myXML:XML = new XML();

    var xmlList:XMLList;

    myXML.ignoreWhitespace = true;

    urlLoader.addEventListener (Event.COMPLETE, fileLoaded);

    urlLoader.load (urlRequest);

    function fileLoaded(event:Event):void {}

    the code to play with the xml file once loaded

    }

    It seems that fileLoaded() is never executed unless the swf runs locally or on my computer or my server or called directly in the browser (like by typing in the web address field). I really can't understand what is wrong. Any suggestion is appreciated!

    try to create a file crossdomain.xml with this information:

    http://www.adobe.com/xml/dtds/cross-domain-policy.dtd">     
    
  • How to load an XML file and save it as a file fm

    Hi Experts,

    I have a bunch of XML files in a folder. I want to make is that I want iteratively, load the xml using a StructuredApplication and save it as a file FM. I was able to sucessfully load the XML file, but I'm having trouble to save a file of FM.

    Here is the code I wrote so far:

    If (sourceFolder! = null) {/ / If a valid file is selected}

    files = new Array();

    fileType = "*.xml";

    files = sourceFolder.getFiles (fileType);  Download all the files that match the pattern

    If (files.length > 0) {/ / get the destination to save the files}

    destFolder = Folder.selectDialog ('Select the folder where you want to save the converted XML files.', ' ~');

    for (var i = 0; i < files.length; i ++) {}

    Set the options to open the XML file.

    var openParams = GetOpenDefaultParams();

    var j = GetPropIndex (openParams, Constants.FS_OpenAsType);

    . propVal.ival openParams [j] = Constants.FV_TYPE_XML;

    j = GetPropIndex (openParams, Constants.FS_StructuredOpenApplication);

    . propVal.sval openParams [j] = "XML Snpsbook";

    j = GetPropIndex (openParams, Constants.FS_FileIsOldVersion);

    . propVal.ival openParams [j] = Constants.FV_DoOK;

    j = GetPropIndex (openParams, Constants.FS_FontNotFoundInDoc);

    . propVal.ival openParams [j] = Constants.FV_DoOK;

    j = GetPropIndex (openParams, Constants.FS_FileIsInUse);

    . propVal.ival openParams [j] = Constants.FV_DoCancel;

    j = GetPropIndex (openParams, Constants.FS_AlertUserAboutFailure);

    . propVal.ival openParams [j] = Constants.FV_DoCancel;

    var returnParams = new PropVals();

    I'M NOT ABLE TO GET THIS LINE TO RUN. sourceDoc RETURNS a REFERENCE of OBJECT INVALID.

    sourceDoc = Open (files [i] .name, openParams, returnParams);  Returns the document object

    Alert (SourceDoc.Name);

    Function to save. XML file. Extension of the FM

    var saveParams = GetSaveDefaultParams();

    var returnParamsp = new PropVals();

    Change the extension .xml FM

    var k = GetPropIndex (saveParams, Constants.FS_FileType);

    saveParams [k].propVal.ival = Constants.FV_SaveFmtBinary;

    saveAsName = sourceDoc.name.replace (/ \.) [ ^\.\\]+$/,".fm");

    var saveInFile = record (saveAsName, saveParams, returnParamsp);  Save as file FM

    saveInFile = new file (destFolder + ' / ' + targetFile);

    saveInFile.close ();  Close file

    }

    Alert ("the files are saved in the FM to ' + destFolder");

    } else {}

    Alert ('no matching files found!');

    }

    }

    Hi reda,.

    You are very close, but there are a few critical flaws in your code that will prevent the proper functioning:

    -Your paths in string literals must have sequences to escape the backslashes. A backslash character is treated as an adverb in an escape sequence, so those need to be escaped themselves. For example: "C:\\Users\\rajrev\\file.xml."

    -Your OpenXMLFile () function does not return anything, then the original DocumentSource variable never gets made.

    -It is better to use the ObjectValid() method to test a valid object of FM.

    -I am not an expert of regular expression, but I can't understand the logic in your replace() method, to create the new path of the file. In addition, the property "name" of the fileObject is invalid, it must be 'name '. I think that there are simpler ways to do.

    -Your call to the Save() method is incorrect. It should be fileObject.Save (saveAsName, saveParams, returnParamsp).

    All that being said, here is a quick review, without comment, that works for me:

    var sourceDoc = openXmlFile("C:\\Users\\rajrev\\file.xml","XML snpsbook");
    if (sourceDoc.ObjectValid()) {
    
        var path = sourceDoc.Name;
        var filename = path.substring((path.lastIndexOf("\\") + 1), path.length);
        filename = filename.replace(".xml", ".fm");
    
        path = path.substring(0, (path.lastIndexOf("\\") + 1));
        path = path + "transformed_files\\" + filename;
    
        //path testing
        //alert(path);
    
        saveToFm(sourceDoc, path);
        sourceDoc.Close(0);
    }
    
    // Function to open and XML file
    function openXmlFile(filePath, structApp) {
        var openParams = GetOpenDefaultParams();
        var i = GetPropIndex(openParams, Constants.FS_OpenAsType);
        openParams[i].propVal.ival = Constants.FV_TYPE_XML;
        i = GetPropIndex(openParams, Constants.FS_StructuredOpenApplication);
        openParams[i].propVal.sval = structApp;
        var  returnParams = new PropVals();
        var doc = Open(filePath, openParams, returnParams);
        return doc;
    }
    
    //Function to save the opened XML as an FM file
    function saveToFm(fileObject, savePath) {
        var saveParams = GetSaveDefaultParams();
        var i = GetPropIndex(saveParams, Constants.FS_FileType);
        saveParams[i].propVal.ival = Constants.FV_SaveFmtBinary;
        var saveAsName = savePath;
        var returnParamsp = new PropVals();
        fileObject.Save(saveAsName, saveParams, returnParamsp);
    }
    
  • Import large XML file to Table

    I have a large (819 MB) XML file I'm trying to import into a table format:
    < ROW_SET >
    < ROW >
    value of < column_name > < / nom_de_colonne >
    < / ROW >
    ...
    < ROW >
    value of < column_name > < / nom_de_colonne >
    < / ROW >
    < / ROW_SET >

    I tried to import with xmlsequence (...). Extract (...) and ran into the number of nodes exceeds maximum error.

    I tried to import with XMLTable (... from XMLTYPE (bfilename('DIR_OBJ','large_819mb_file.xml'), nls_charset_id('UTF8'))) and I gave up after he had run for 15 + hours (COLLECTION ITERATOR PICKLER FETCH number).

    I tried to import them with:

    insCtx: = DBMS_XMLStore.newContext ('schemaname.tablename');
    DBMS_XMLStore.clearUpdateColumnList (insCtx);
    DBMS_XMLStore.setUpdateColumn (insCtx, 'column1name');
    ...
    DBMS_XMLStore.setUpdateColumn (insCtx, 'columnNname');
    LINES: = DBMS_XMLStore.insertXML (insCtx, XMLTYPE (bfilename('DIR_OBJ','large_819mb_file.xml'), nls_charset_id ('UTF8')));

    and ran in ORA-04030: lack of memory of process when trying to allocate 1032 bytes (subheap qmxlu, qmemNextBuf:alloc).


    All I have to do is read the XML file and move the data into a table in a reasonable time. Once I have given in the database, no longer need the XML file.

    What would be the best way to import large XML files?


    Oracle Database 11 g Release 11.2.0.1.0 - 64 bit Production
    PL/SQL Release 11.2.0.1.0 - Production
    "CORE 11.2.0.1.0 Production."
    AMT for Linux: Version 11.2.0.1.0 - Production
    NLSRTL Version 11.2.0.1.0 - Production

    (Gross) approach should work for you.

    CREATE TABLE HOLDS_XML
            (xml_col XMLTYPE)
          XMLTYPE xml_col STORE AS SECUREFILE BINARY XML;
    
    INSERT INTO HOLDS_XML
    VALUES (xmltype(bfilename('DIR_OBJ','large_819mb_file.xml'), nls_charset_id('UTF8')))
    -- Should be using AL32UTF8 for DB character set with XML
    
    SELECT ...
      FROM HOLD_XML HX
           XMLTable(...
              PASSING HX.xml_col ...)
    

    How it differs from your approach.

    With the help of the HOLDS_XML table with storage XML BINARY SECUREFILE (which become the default in 11.2.0.2), we provide a place for Oracle store a parsed version of the XML data. This allows the XML code to be stored on the disk instead of memory. Oracle can then access the necessary XML fragments of the disc in the instead holding the entire XML in memory and the analysis several times to find the necessary information. That's what COLLECTION ITERATOR PICKLER FETCH means. A lot of memory. You can search on this term to learn more about this if necessary.

    The approach XMTable then simply reads this XML to disk file and should be able to parse the XML without problem. You have the option to add XML indexes, but since you read just a while and throw it away, there is no advantage to (most likely) index

  • Navigate trough different 'levels' in the XML file from the known item?

    I am quite new to this, so I have to ask even if it's a stupid question...

    I am trying to build a generic oracle procedure that can insert data into a table from a file XML so that message that it contains, but of course the messages has the same structure.

    I need to find the first item after data, in this case "CUS_ORD_HEAD", but it could be any message as PO_HEAD.
    So I need to somehow find the element without knowledge is the name of the element. It goes same for CUS_ORD_LINE that might be PO_LINE. Is it possible to navigate through the different 'levels' in the XML file from a known element.

    < CustomerOrder >
    < metadata >
    < TransActionIdentity > 1 < / TransActionIdentity >
    < / metadata >
    < data >
    < Client CUS_ORD_HEAD = 'ABC' CustomerOrderNumber '1234' = >
    < CUS_ORD_LINE CustomerOrderNumber = "1234" OrderedQuantity = "10" ProductNumber = "1001403" CustomerOrderLinePosition = "1" / >
    < HAPI_CUS_ORD_LINE CustomerOrderNumber = "1234" OrderedQuantity = "1" ProductNumber = "2530" CustomerOrderLinePosition = "2" / >
    < CUS_ORD_LINE_TEXT CustomerOrderLinePosition = '2' Text = "Test" CUSTOMERORDERNUMBER = "1234" / >
    < / HAPI_CUS_ORD_HEAD >
    < / data >
    < / CustomerOrder >

    the tablename parameter is identical to the XML element and attributes are the same as the columns

    OK, understood.

    You can retrieve the name of the element and attribute names in the same time by using something like the following.
    Attribute names are stored in a collection that is accessible iteratively in order to build the dynamic parts of the query:

    SQL> CREATE OR REPLACE TYPE TColumnList IS TABLE OF VARCHAR2(30);
      2  /
    
    Type created
    
    SQL> set serveroutput on
    SQL>
    SQL> DECLARE
      2
      3   xmldoc   xmltype := xmltype('
      4  
      5  
      6  1
      7  
      8  
      9  
     10  
     11  
     12  
     13  
     14  
     15  
     16  
     17  ');
     18
     19   --t_column_list TColumnList := TColumnList();
     20   --v_table_name  VARCHAR2(30);
     21
     22   tmp_cols      VARCHAR2(1000);
     23   tmp_paths     VARCHAR2(1000);
     24   tmp_qry       VARCHAR2(4000);
     25
     26  BEGIN
     27
     28    FOR r IN (
     29      SELECT table_name
     30           , set(cast(collect(column_name) as TColumnList)) as column_list
     31      FROM XMLTable(
     32           'for $i in /CustomerOrder/Data/descendant::*
     33              , $j in $i/attribute::*
     34            return element e
     35            {
     36              element TABLE_NAME {name($i)}
     37            , element COLUMN_NAME {name($j)}
     38            }'
     39            passing xmldoc
     40            columns
     41              table_name   varchar2(30)
     42            , column_name  varchar2(30)
     43           )
     44      GROUP BY table_name
     45    )
     46    LOOP
     47
     48      tmp_cols := NULL;
     49      tmp_paths := NULL;
     50
     51      --dbms_output.put_line(r.table_name);
     52
     53      FOR i in 1 .. r.column_list.count LOOP
     54
     55        tmp_cols := tmp_cols || ', ' || r.column_list(i);
     56        tmp_paths := tmp_paths || ', ' || r.column_list(i) || ' varchar2(35) path ''@' || r.column_list(i) || '''';
     57
     58      END LOOP;
     59
     60      tmp_cols := ltrim(tmp_cols, ', ');
     61      tmp_paths := ltrim(tmp_paths, ', ');
     62
     63      tmp_qry := 'INSERT INTO ' || r.table_name || ' (' || tmp_cols || ') ' ||
     64                 'SELECT ' || tmp_cols ||
     65                 ' FROM XMLTable(''/CustomerOrder/Data/descendant::' || r.table_name || '''' ||
     66                 ' PASSING :1 ' ||
     67                 'COLUMNS ' || tmp_paths ||
     68                 ')';
     69
     70      dbms_output.put_line(tmp_qry);
     71
     72    END LOOP;
     73
     74  END;
     75  /
    
    INSERT INTO CUS_ORD_HEAD (CustomerOrderNumber, Customer) SELECT CustomerOrderNumber, Customer FROM XMLTable('/CustomerOrder/Data/descendant::CUS_ORD_HEAD' PASSING :1 COLUMNS CustomerOrderNumber varchar2(35) path '@CustomerOrderNumber', Customer varchar2(35) path '@Customer')
    INSERT INTO CUS_ORD_LINE (CustomerOrderNumber, OrderedQuantity, ProductNumber, CustomerOrderLinePosition) SELECT CustomerOrderNumber, OrderedQuantity, ProductNumber, CustomerOrderLinePosition FROM XMLTable('/CustomerOrder/Data/descendant::CUS_ORD_LINE' PASSING :1 COLUMNS CustomerOrderNumber varchar2(35) path '@CustomerOrderNumber', OrderedQuantity varchar2(35) path '@OrderedQuantity', ProductNumber varchar2(35) path '@ProductNumber', CustomerOrderLinePosition varchar2(35) path '@CustomerOrderLinePosition')
    INSERT INTO CUS_ORD_LINE_TEXT (CUSTOMERORDERNUMBER, Text, CustomerOrderLinePosition) SELECT CUSTOMERORDERNUMBER, Text, CustomerOrderLinePosition FROM XMLTable('/CustomerOrder/Data/descendant::CUS_ORD_LINE_TEXT' PASSING :1 COLUMNS CUSTOMERORDERNUMBER varchar2(35) path '@CUSTOMERORDERNUMBER', Text varchar2(35) path '@Text', CustomerOrderLinePosition varchar2(35) path '@CustomerOrderLinePosition')
    
    PL/SQL procedure successfully completed
     
    
  • AS3, obtain the names of files in the Flash .exe or .app folder, no Air

    I build a Flash project that will read a file to get the names of the images & videos, so they can be added dynamically in the Flash project. The .swf, the .app or .exe, but I pulled out the final version, will run on a PC or a Mac that is hooked up to a monitor large flat screen.

    If the project was used on the web, I would say just a .php script to clear the names of files in an .xml file. However, the Flash and the computer will be offline.

    I have not built anything with air, so I did not have enough time to get in tune with him in order to to use. I know that AIR as3 has a FileListEvent class that has a method getDirectoryListingAsync to read a directory.

    So my question is, is it possible to read the names of a directory in a folder when Flash is running in offline mode?

    I was wondering if it would be feasible to running a script BACK or a script similar to Mac BACK.

    Or is there a better way?

    Thanks in advance for your reply,

    Zak

    sinious,

    a colleague of mine told me that apache & .php are integrated in Mac OS X. There is a good chance I'll run the flash on a Mac so I can take advantage of this option.

    http://foundationphp.com/tutorials/php_leopard.php

    Zak

  • load the XML file field Companion without cross-domain policy file

    Hello.

    Assuming that there are two areas companions on the same server: /public_html/domain1.com and /public_html/domain2.com

    I'm trying to load the XML from domain2.com in domain1.com without using a cross-domain policy file (since it does not work with xml files in my case).

    So the idea is to use a php file to load XML and read it back to Flash.

    I found an interesting scripts that seems to do the job, but unfortunately I can't make it work. In my opinion, there is somewhere with AS3 part problem. Please take a look.

    Here's the AS3/PHP scripts:

    AS3 (.swf in www.domain1.com):

    location of the xml file you want to load, full http address

    var xmlLoc:String = " " http://www.Domain2.com/MyFile.XML ";

    location of the php xml grabber, regarding the .swf

    var phpLoc:String = "loadXML.php";

    var xml;

    var loader: URLLoader = new URLLoader();

    var request: URLRequest = new URLRequest (phpLoc + "? location =" + escape (xmlLoc));

    loader.addEventListener (Event.COMPLETE, onXMLLoaded);

    loader.addEventListener (IOErrorEvent.IO_ERROR, onIOErrorHandler);

    Loader.Load (request);

    function onIOErrorHandler(e:IOErrorEvent):void {}

    trace ("there was an error with the xml file" + e);

    }

    function onXMLLoaded(e:Event):void {}

    trace ("RSS feed has been loaded");

    XML = new XML (loader.data);

    / / string value, because it is passed from php as object

    XML = XML (xml.toString ());

    xml_txt.text = xml;

    }

    PHP (loadXML.php to www.domain1.com):

    <? PHP

    Header ("Content-type: text/xml");

    $location = "";

    {if (isset($_GET["location"]))}

    $location = $_GET ['location'];

    $location = urldecode ($location);

    }

    $xml_string = getData ($location);

    return the url encoded Flash vars

    echo $xml_string;

    Loops of a URL and returns

    function getData ($query) {}

    / / create resource curl

    $ch = function curl_init();

    / / cURL url

    curl_setopt ($ch, CURLOPT_URL, $query);

    Set some required params for the use of CURL

    curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, false);

    curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);

    Execute the loop works and decode the returned JSON data

    $result = curl_exec;

    return $result;

    / / Close the curl resource to free up system resources

    curl_close ($ch);

    }

    ? >

    I think you might be right about / permissions on the server for php settings. Unfortunately I'm not allowed to adjust.

    So I wrote my own script - this time I used the path instead of the http address of the XML file.  It works fine in my case.

    Here it is:

    XML file on domain2.com:

    SWF on domain1.com:

    var imagesXML:XML;

    var variables: URLVariables = new URLVariables();

    var varURL:URLRequest = new URLRequest ("MyPHPfile.php");

    varURL.method = URLRequestMethod.POST;

    variable = varURL.data;

    var MyLoader:URLLoader = new URLLoader;

    MyLoader.dataFormat = pouvez;

    MyLoader.addEventListener (Event.COMPLETE, XMLDone);

    MyLoader.load (varURL);

    function XMLDone(event:Event):void {}

    var imported_XML:Object = event.target.data.imported_XML;

    imagesXML = new XML (imported_XML);

    MyTextfield_1.text = imagesXML;

    MyTextfield_2.text = imagesXML.image [0] .attribute ("thumbPath");  reference sample to assign "thumbPath' of the first item

    }

    php on domain1.comfile:

    <>

    $xml_file = simplexml_load_file('.. /.. / /galleries/gallery_1/MyXMLfile.xmldomain2.com');  Directory of XML file on the same server

    $imported_XML = $xml_file-> asXML();

    Print "imported_XML =". $imported_XML;

    ?>

    Concerning

    PS: for those who have read the foregoing: the first and the second script works but you need to test which one is best for your situation. The first script will work also between two domains located on different servers. No. cross necessary domain policy file.

  • How do I download/save a local XML file

    Hello, I'm developing a game of amateur video on Flex 4, which will be downloadable and execution in the local file system (such as "C:/Games/myGame/myGame.html"). I try to save and load the registry of players in an XML file, also locally (as 'C:/Games/myGame/records.xml).

    So far, I was abled to load the file like this:

    var loader: URLLoader = new URLLoader();

    var request: URLRequest = new URLRequest ("records.xml");

    var recordsXml: XML;

    try {}

    _ loader.load (request);

    _ recordsXml = new XML (loader.data);

    }

    catch (...)

    After that, I can then extracts the data perfectly recordsXml. However, I can't figure out what code to use to save changed data. I tried this:

    var request: URLRequest = new URLRequest ("records.xml");

    Request.Data = recordsXml.toXMLString ();

    request.contentType = "text/xml";

    Request.Method = URLRequestMethod.POST;

    loader.dataFormat = URLLoaderDataFormat.TEXT;

    try {}

    _ loader.load (request);

    }

    catch (...)

    The code runs without error, but the file is not updated. I tried to record data on a second, empy file records2.xml, but it does not work either.

    What should I do? Thank you!

    For web applications, you can use the FileReference class. This allows you to

    Open a dialog box to the user to load an external file, or save it to their

    computer. Here are more details:

    http://help.Adobe.com/en_US/AS3/dev/WS5b3ccc516d4fbf351e63e3d118a9b90204-7cf8.html

    Please note that this only works if the user triggers the action and

    through the file dialog box. You can not save or load files without their

    knowledge from a web application. A desktop AIR app is different and may

    load/save files in the background.

    iBrent

  • How to make a backup in the Flash iphone ios xml file?

    Hi, I'm looking for a way to pause for an ipad app, when you press the home button. If you exit the application, you can return
    the place that you were in.

    Is there a toggle in flash CS5.5 who does that? If not, is there an AS3 code that I can put in my first image?

    I saw the code below on a post recently, if I think I he would insert near the bottom of the XML file. But every time I have to change this option and

    re-publish the FLA, it comes up with errors.

    I would like to a setback of this code below - instead of out, take a break. and also need to know exactly where to put it?

    "When a user switches away an AIR application it penetrates in the back and stops." If you want that your application for leave completely rather than take a break, set the YES UIApplicationExitsOnSuspend property'

    < key > UIApplicationExitsOnSuspend < / key >

    < string > No. < / string >

    Anyone who has a simple solution for this? Thank you!

    It is not dependent on air wedged in your system, it is simply based on package manager you use. If you use a CS5.5 trial download, then the second line of the xml app descriptor should read as follows:

    http://ns.Adobe.com/air/application/2.6">

    That would show that it is AIR 2.6.
  • Through the XML file in a table?

    Hi all

    I am having trouble interrperting how I should browse a XML file and pushing it toward a table to display data sets.

    Here is my as:

    myXML = new XML();
    myXML.ignoreWhite = true;
    myXML.onLoad = {function (ok)}

    If {(ok)
    ALLDATA = this.firstChild.childNodes;
    allEntries = this.firstChild.firstChild.childNodes;

    for (i = 0; i < alldata.length; i ++) {}
    trace (newline + "letter:" + alldata [i] .nodeName);

    for (r = 0; r < allEntries.length; r ++) {}
    trace(allEntries[r].nodeName+":"+allEntries[r].firstChild);
    }

    }

    } else {}
    trace ("loading error");
    }
    };
    myXML.load ("temp_glossary.xml");

    This is my XML:

    <? XML version = "1.0" encoding = "iso-8859-1? > <!-this - >
    < Glossary >

    < A >

    < aardvark > he is an Aardvark < / Aardvark > <! - firstChild.firstChild.firstChild - >
    < Apple > it is an Apple < / Apple >
    < EPA > it's a monkey < / EPA >
    < /A >

    < B >
    < Ball > it is a ball < / balls >
    < bat > it is a bat < / Bat >
    < bike > it is a bike < / Bike >
    < /B >

    < C >
    < drive > it is a car < / car >
    < heading > it is a cap < / Cape >
    < Cook > This is a Cook < / Cook >
    / < C >
    < / Glossary >

    Output is currently:

    Letter: A
    Aardvark: he is an Aardvark
    Apple: this is an Apple
    EPA: it is a monkey

    Letter: B
    Aardvark: he is an Aardvark
    Apple: this is an Apple
    EPA: it is a monkey

    Letter: C
    Aardvark: he is an Aardvark
    Apple: this is an Apple
    EPA: it is a monkey

    The output, I see I only have access to the firstChild whenever I write the words, but I do not know how to go about it increments to the next block of words.  I guess I can do with a 2D array and iteration, but don't know how to implement.

    Any help would be greatly appreciated, thank you.

    Chris

    :

    myXML = new XML();
    myXML.ignoreWhite = true;
    myXML.onLoad = {function (ok)}
    If {(ok)
    ALLDATA = this.firstChild.childNodes;
    allEntries = this.firstChild.firstChild.childNodes;
    for (i = 0; i
    trace (newline + "letter:" + alldata [i] .nodeName);
    for (r = 0; r
    trace (Alldata [i] Sublst.ChildNodes(1).ChildNodes(0) [r].firstChild.nodeValue);
    }
    }
    } else {}
    trace ("loading error");
    }
    };

  • Is it possible to search for key words in an XML file?

    Hey all,.

    I am currently looking for ways to count the number of keywords in an XML file. An example would be trying to find how many times 'war' is mentioned in a network of new RSS feed < title > < / title > and adding it to a variable.

    I found a few AS3 XML class custom there files but nothing that I was able to adapt. I'm to the point just taking the title of these stories convert all channels and their research in this way...

    I would be grateful for any help

    Thank you!

    Just to clarify the JCSurf

    In your example, you're checking whether the XML element has an attribute "NAMED" keywords.

    If you try to determine the number of times keyword 'war' appears in a specific XML newsfeed, I guess that XML elements already have an attribute named "Key words" and you check in to this existing attribute and then check if the word ' war exist in the keywords attribute, and then finally to count the number of times where that is. "

    ============

    function negativeKeyword(keywords:String)

    {

    for (var i: Number = 0; i< 29;="">

    {

    If (myXML.channel.item.title [i] .attribute == keywords) / / this is only check verifies if an attribute exists that is called keywords

    {

    -negativeNumber;

    }

    }

    }

    ============

    It should check to see if the keyword attribute is an element tag and if it contains the word 'war '.

    If (myXML.channel.item.title [i] .attribute ("keywords") is 'war')

    I also believe you need to do your quoted strings.

    Keep me posted.

  • Save the object as a xml file xml

    Hello

    I loaded my .xml file into an XML object using URLLoader; and URLRequest. I transferred some data in a table and a data grid, it handled etc.

    I now have this XML object with the updated records. So, how to save it to an .xml file so the system can read the documents/data in it if necessary?

    Thank you

    BadFortune,

    > I wasn't planning on using on in the flash IDE, I just wanted to
    > to use as a standalone .swf file I could run from any
    > machine with flash player, for watching/editing captions.

    Sounds like an ideal candidate for an AIR application!
    ( http://www.adobe.com/products/air/) AIR provides more features that
    running Flash Player, including the ability to write files to the hard drive
    drive. He works directly with Flash (and other technologies), so should be
    feel quite familiar to what you have already seen in AS3. Indeed, search
    the logo of AIR in the docs and you will see specific AIR APIs.

    http://livedocs.Adobe.com/Flash/9.0/ActionScriptLangRefV3/index.html

    > Can I trace only the output to a file within the IDE? What AS3
    > class should I use for this?

    To trace output to the Panel of output in the IDE, use the global trace()
    function. To save a file in AIR, see the File class.

    David Stiller
    Adobe Community Expert
    Dev blog, http://www.quip.net/blog/
    "Luck is the residue of good design."

  • Overwrite the XML file

    Hello
    I want to replace a XML file on my localhost, I always get an error "Error #1088:"markup in the document following the root element must be well-formed.""
    AS3:

    function upload (): void {}
    trace ("upload");
    str1 = ' <? XML version = "1.0" encoding = "ISO-8859-1'? '" "> < text > said is een test < / text >";
    XML = new XML (str1);
    urlRequest = new URLRequest (" http://localhost/XML/save.php");
    urlRequest.data = str1;
    urlRequest.contentType = "text/xml";
    urlRequest.method = URLRequestMethod.POST;
    loader = new URLLoader();
    loader.addEventListener (Event.COMPLETE, onComplete, false, 0, true);
    loader.addEventListener (IOErrorEvent.IO_ERROR, onIOError, false, 0, true);
    Loader.Load (urlRequest);
    }
    function onComplete(evt:Event):void {}
    try {}
    xmlResponse = new XML (evt.target.data);
    respTxt.text = xmlResponse;
    removeEventListener (Event.COMPLETE, onComplete);
    removeEventListener (IOErrorEvent.IO_ERROR, onIOError);
    } catch (err: TypeError) {}
    respTxt.text = "an error occurred during communication with the server: \n ' + err.message;
    }
    placeText();
    }
    function onIOError(evt:IOErrorEvent):void {}
    respTxt.text = "an error occurred when trying to load the XML.\n" + evt.text;
    placeText();
    }
    function placeText (): void {}
    respTxt.x = 15;
    respTxt.y = 15;
    respTxt.multiline = true;
    respTxt.autoSize = TextFieldAutoSize.LEFT;
    addChild (respTxt);
    }
    Save.php:
    <? PHP
    If (isset ($GLOBALS ["HTTP_RAW_POST_DATA"])) {}
    $xml = $GLOBALS ['HTTP_RAW_POST_DATA'];
    $name = "XML/data1.xml".
    $file = fopen ($name, "w");
    fwrite ($file, $xml);
    fclose ($file);

    ECHO ($Globals ["HTTP_RAW_POST_DATA"]);
    }
    ? >
    Thank you for helping me

    No, it won't, because the next line handles things (xml = new XML (str1);). Either by the way, it is strange to see AS3 with no variable typing. A line should say: var xml = new XML (str); No xml = new XML (str); Both will not work if you have a strict typing in the compiler settings, disabled but it's a good idea to have strictly implemented, it will help to identify some questions before starting the film.

    But this problem is not due to variable typing, I think it's because your xml file is not complete the minimum requirements for well-formed XML documents. Read this:

    http://en.Wikipedia.org/wiki/well-formed_XML_document

    If I read that correctly, you must have a root element, which would mean that it should work for you:

    str1 ="Is a test';
    XML = new XML (str1);

    The 'texts' tag will act as the root element.

  • 1 xml file, 2 drop-down lists

    I've recently set up a video player based on the form tutorial Lisa Larson-Kelley on the construction of a XML playlist, which I managed to get to work. I wanted to take this to the next step in the creation of a second listbok or buttons for categories where only the videos in the category would be displayed in the listbox or title list. I saw information about AS2 solutions, but not for AS3. I have the XML file not that I modified to include a category tag which I was able to analyze the category names in a listbox control, but I'm stuck on the sending of data from the category selected for a second ttilist. I use the following approach to target the second box:

    toplist.addEventListener (Event.CHANGE, itemChange);
    function itemChange(e:Event):void {}
    Blist = toplist.selectedItem.data;

    In the tests, by clicking on the toplist category returns the errror

    TypeError: Error #1034: Type coercion failed: cannot convert XML@43c0b081 CISCO (category name) attribute in fl.controls.TileList.

    If a thread for this exist, or you have some useful suggestions, please and thank you.

    I could be wrong, but anytime I have consulted a list or combo or tilelist I had to pull the out point and save it in a generic object before it would let me mess with data. I never got the selectedItem.data to work.

    Have you tried to do a smart object and then registering the selectedItem in there?

    var tObject:Object = new Object();
    tObject = toplist.selectedItem;

    tObject.data

  • What is an xml file and how to find a missing one?

    What is an xml file? How to find one that is missing?

    In short, an XML file is a file structured data - in other words, it stores the data in a way that is easy for a computer scan and read, but it is also easy(-ish) for a human to read, too.

    Generally, XML can be used for configuration or preference data, or for the exchange of data between applications, but there are a multitude of possibilities.

    This means that, with regard to the resolution of your problem is concerned, that was no help. The whole point of XML is that it is easy for any application store some data he needs, so you need to be more specific on what application you are using and what XML file it is looking for. Only then can someone (possibly) steer you in the right direction.

Maybe you are looking for