A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: Can someone help me figure this out???

  1. #1
    Senior Member
    Join Date
    Feb 2001
    Location
    Provo, Utah
    Posts
    1,112
    WARNING!!! WARNING!!! WARNING!!!

    NOT FOR THE OFFENDABLE.

    WARNING!!! WARNING!!! WARNING!!!

    What is the big fetish with taking a beautiful XML structured document/Object and throwing it into an ugly Array Object???

    I would love it if someone wouldn't mind engaging me in an intelligent argument about how this is supposed to help!

    ... ok - I'm done ranting - for now.

    Any takers?

    P.s. - No. I've never sullied an XML Object with Array-like restrictions.

    P.p.s. - Not like Arrays are of the Devil. They have their place. In the Stone Age.

    ( Oh. Sure. I love my fork. It looks so nice sitting right next to my plate - I just feel more comfortable using my hands to eat my food. )

    P.p.p.s. - Don't bother flaming. Try actually proving that there is a use.

  2. #2
    Member
    Join Date
    Apr 2001
    Location
    AU
    Posts
    42

    Heed his words!

    Couldnt agree more!

    However, the flash implementation of the DOM has a lot to be desired... Ever noticed what an XML object in flash looks like when you look at the variables in debug? I hope that that twisted tree is using internal referencing instead of creating a new object for every
    Code:
    firstChild.nextSibling.previousSibling
    (stupid as it is) query.

    Even so, I have never turned my XML Object into an array - Why have it organized in such a way only to break it down?

  3. #3
    Senior Member tupps's Avatar
    Join Date
    Jan 2001
    Location
    Melbourne
    Posts
    2,035
    Well it is people who are using XML not for any of its usefullness but simply a way to load data.

    My current thing is lots and lots of people seem to be hard coding the structure of their XML into there code. The first sign that people are doing this is complaining about whitespace. I beleive both your problem with array types and my problem with XML structure in the app are related to the same phenomenon:

    People are not using the full features of XML. I believe that people are simply using ML dropping out the X. I believe that the whole power of XML comes from the extensible nature.

    I think a lot of people missing seeing the fact that if they create a stream of data that they can use that information for another purpose as well without breaking there original code.

    For example if I have a CD collection that I use a flash interface to browse and I have:

    < CD Name="Smash" Artist="Offspring" >
    < Track Number="1" Name="Welcome" />
    < Track Number="2" Name="Come out and play" />
    </CD>

    (Disclaimer -- XML not tested and just used to prove a point!, and yes I do know that come out and play is not track 2!, i can't be bothered finding the case ;-)

    I can create a sweat little flash player to display this information. I use XML that looks for the names of attributes and nodes there is no problem if I later extend this for a web page that I want to display using XSL:

    < CD Name="Smash" Genre="Alternative" Artist="Offspring">
    < Track Number="1" rating="1" Name="Welcome" />
    < Track Number="2" rating="10" Name="Come out and play" />
    < Multimedia Rating="3" PC="Yes" Mac="Yes" QuicktimeContent="Yes" Applications="No" />
    </CD>

    Now if I had used specific ordering expecting my data in a set order this routine would end up buggered up. I can also add addtional node tags to the XML (eg a tag describing CD-ROM data at the end of the CD) and my app.

    My guess is that most people don't code like this because they only see the one application for there data -- Their flash app. They don't see the possibilty of rendering a web page with it using XSL, or loading it into another app, exchanging it with a web site.

    If they need to do any of those things they will start the process from scratch. I guess it boils down to that many people aren't interested or haven't realised that you can do all this with flash.

    Thanks for listening

    Luke



  4. #4

    Post

    Ok, I'm game for discussion. (even with my limited exposure to XML -- I'm on a high learning curve right now).

    As a rebuttal, let me quote/paraphrase from a recent text in Flash 5 Actionscript Studio.
    ---------
    When the Actionscript interpreter renders the procedures of an XML handling routine, it has to maintain a memory of each object, var, string, and number that it encounters for as long as they are relevant. An XML doc is rendered by the XML parser as a complex of arrays. When navigating these arrays it's necessary for the interpreter to maintain each object assoc. with the document's DOM structure within memory. If the document is very complex, and/or there are many other objects created in the course of navigation, the amount of memory available to the interpreter can diminish to the point that the performance of the Flash app can be affected. <bold> This is why it's a good idea to map a document's DOM structure to individual sets of arrays. When information is extracted from an array, only the elements of that array are held in memory.</bold>

    If the array represents the childNodes of a single node element of the document, then only the data of those child nodes is present.
    ----------

    I can attest to looking at the tree that the XML object builds, and it's quite disastrous, mostly due to the whitespace problem. By simply parsing this data into more compact arrays, it should help your application significantly.

    I must say, you nay-sayed arrays in your original post, but doesn't the Flash parser automatically stick it into a complex set of arrays anyway?

    - jonny
    - hollow planet web design

  5. #5

    Post

    Ok, I'm game for discussion. (even with my limited exposure to XML -- I'm on a high learning curve right now).

    As a rebuttal, let me quote/paraphrase from a recent text in Flash 5 Actionscript Studio.
    ---------
    When the Actionscript interpreter renders the procedures of an XML handling routine, it has to maintain a memory of each object, var, string, and number that it encounters for as long as they are relevant. An XML doc is rendered by the XML parser as a complex of arrays. When navigating these arrays it's necessary for the interpreter to maintain each object assoc. with the document's DOM structure within memory. If the document is very complex, and/or there are many other objects created in the course of navigation, the amount of memory available to the interpreter can diminish to the point that the performance of the Flash app can be affected. <bold> This is why it's a good idea to map a document's DOM structure to individual sets of arrays. When information is extracted from an array, only the elements of that array are held in memory.</bold>

    If the array represents the childNodes of a single node element of the document, then only the data of those child nodes is present.
    ----------

    I can attest to looking at the tree that the XML object builds, and it's quite disastrous, mostly due to the whitespace problem. By simply parsing this data into more compact arrays, it should help your application significantly.

    I must say, you nay-sayed arrays in your original post, but doesn't the Flash parser automatically stick it into a complex set of arrays anyway?

    - jonny
    - hollow planet web design

  6. #6
    Senior Member
    Join Date
    Feb 2001
    Location
    Provo, Utah
    Posts
    1,112

    Uhh...

    Ahhhh... soo good... intelligent arguments...

    About the XML->Flash->Array anyway, so why not hard code it that way... Shame on you! Sorry if I wasn't clear. What I meant was: You lose a certain.. flavor.. a certain ability to handle data when it's dealt with in an Array.

    Yes. I looked at the debugger the first time I loaded an XML document. That's probably the bet explanation of why Flash is so slow at loading/parsing an XML document.

    < note location='side' > Flash player v5 sucks at parsing XML (can you say .. let's throw it all into arrays/objects and have them relate)... has anyone tried out the Flash Player v6 beta?? I have. It is screamingly faster - dare I say - usably faster (!!!) at parsing XML. I'll post a different thread with my findings... < / note >

    Anyway... I couldn't agree with the above posts more. XML stands for 'extensible'. Which is why I would love to see a SAX implementation or a 'DTD' implementation of XML in Flash. Either would open up posibilities. (Yeah - I know... people have made their own - so have I. What I mean is - I would love to see it built into Flash 6).

    As for the quote from the Flash 5 book by HollowPlanet... You're probably right. That's why Flash 6 should approach it in a different manner - the correct manner. I also believe that if you bring in an XML document, you should be able to get the information out of it that you need - and not worry about it later. Now I'm not saying that you should only access the document once - but that any need for array like access is the same using XML methods or Array methods.

    I guess my real point to the above paragraph is like tupps said, "Well it is people who are using XML not for any of its usefullness but simply a way to load data." If you don't USE XML.. then why USE XML? That could actually be my original question. XML was designed looking forward - throwing it all into Arrays - (be it done by the developer or Macromedia) is looking backward. Hence the reference to fork-in-hand vs. fork-by-plate. Technology could grow so much faster if we'd stop strapping it to history.

    Ok. I'm done ranting for now.

    Thanks for the intelligent responses.

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