1 Reply Latest reply on May 9, 2012 4:52 AM by Ned Murphy

    Instances based on xml data

    Toonces the Cat Level 1

      hi there. i have a pretty straightforward task i need to do, and having a programming background, i know the theory behind what i need to do - i just need to suss out how exactly it's done in as3.

       

      I want to make a sports schedule that ingests the XML data and displays it. End product will look something like this :

       

      January 1, 2013

      Lakers v Celtics, 7pm

      Bulls v Hawks, 10pm

      Heat v Spurs, 10pm

       

      January 2, 2013

      Raptors v Bucks, 6pm

       

      and so on.

       

      As you can see, the issue is mainly that there are two types of formatting, and an unknown number of games for each particular date. So i assume that i need to create a "header" object and a "game" object, and create instances of each dynamically at runtime. Any guidance on how i would go about this?

       

      in pseudo code, i want to do something like this i think :

       

      - read xml object

        - if <style> tag is "header", then create an instance of the header object and populate with the data from this line

        - if <style> tag is "game" then create an instance of the game object and populate

        - position the new object at the bottom of the list

        - read next XML object

        - repeat until end of the list

       

      is there a way to change te font size and color without using TLF?

        • 1. Re: Instances based on xml data
          Ned Murphy Adobe Community Professional & MVP

          The approach you outlined should work fine.

           

          You do not need to use a TLFTextField.  From what I hear, if you do not have a reason for using a TLF (like a need for right to left text), then don't... stick with classic TextFields and avoid the TLF.

           

          You can control the text formatting using the TextFormat class.  In your case you can probably just style the TextField manually when you create  the library symbols that you will use for the instances you add... one using red text at the size you want and the other using black text at the slightly larger size.