Stuff to click on

Tuesday, March 6

360flex - E4X

presented by Danny Patterson

New XML classes in AS3
  • all old functions from AS2 still available
  • XMLList - if there is only one item in the list it will act like the type of that item
  • QName
  • Namespace


Creating XML Objects
  • Parse XML Strings - pass a string into a constructor
  • Use a literal
  • Create an XMLList


Using the language

Property accessors
  • Everything is an XMLObject, from the children and the data contained in them... even comments!!
  • Two dots returns all items, regardless of their level in the XML schema (to retrieve nested children)
  • Wildcards (*) - gets all elements under the catalog, so you don't have to know the child or element names
  • @* - gets all the attributes of a child, useful if you don't know the schema but want to see what's available


Filtering
  • can set conditional statements in variable assignments of type XMLList (i.e.
  • @id==0 will get element(s) where id value is 0
  • price<5 will get elements where value of price is less than 5
  • price>=35 && price <=50 will get elements where value of price is between 35 and 50
  • desc="toaster" will get elements where value of desc is toaster (type string)


Iterating (fancy word for "looping")
  • "for" loops similar to other PL's but in var declaration, useful for totaling columns
  • "for..in" loops
  • Neither of these are recommended methods... so try one of these instead!
  • "for each..in" loops


Namespaces (how to group related objects) - extends Sprite
  • Create an envelope with soap namespace and then create a body element
  • Create a variable of type Namespace that points to the soap and add to the body
  • Use a default xml namespace and add to the body


Sending and Loading
  • No longer a part of the XML object
  • URLRequest
  • URLLoader

No comments: