4 Replies Latest reply on Jan 9, 2007 9:44 AM by la_guitar

    XML and Class Implementation?

      Hey everyone,

      I'm new to this forum and pretty new to AS.
      I've created a fairly simple navigation bar.

      SWF Sample

      What I'd really like to do make this entirely dynamic by loading the images, tab names and hyperlink via XML (or an array). That way, I could use the same SWF and edit it via XML. I understand AS pretty well, but haven't wrapped my head around implementing XML and extending classes and such.

      Any help or direction would be greatly appreciated. If you'd like the FLA, just let me know.

      Cheers,
      Michael
        • 1. Re: XML and Class Implementation?
          Level 7

          "la_guitar" <webforumsuser@macromedia.com> wrote in message
          news:eo0f8q$md6$1@forums.macromedia.com...
          > Hey everyone,
          >
          > I'm new to this forum and pretty new to AS.
          > I've created a fairly simple navigation bar.
          >
          > http://radarseven.com/samples/
          >
          > What I'd really like to do make this entirely dynamic by loading the
          > images,
          > tab names and hyperlink via XML (or an array). That way, I could use the
          > same
          > SWF and edit it via XML. I understand AS pretty well, but haven't wrapped
          > my
          > head around implementing XML and extending classes and such.
          >
          > Any help or direction would be greatly appreciated. If you'd like the FLA,
          > just let me know.
          >
          > Cheers,
          > Michael
          >

          First thing I would do is get this book
          http://www.friendsofed.com/book.html?isbn=1590595947

          Or you can just download the files that go with the book and try to figure
          them out, but I wouldn't recommend it without the text.
          http://www.friendsofed.com/download.html?isbn=1590595947

          This book covers classes and extension of classes very well.




          • 2. Re: XML and Class Implementation?
            Level 7
            Michael,

            > I understand AS pretty well, but haven't wrapped my
            > head around implementing XML and extending classes
            > and such.

            XML can get complicated, because it deals with external files, but on
            the other hand, the XML class, which defines your the XML object you'll
            need, is like any other class in the ActionScript 2.0 Language Reference.
            The XML class entry is your one-stop shop for all the functionality of that
            object, including its properties (characteristics), methods (things it can
            do), and events (things it can react to).

            Here's a free tutorial on XML in Flash, from Community MX.

            http://www.communitymx.com/abstract.cfm?cid=E399FF13E4DD1CB3

            This was written before AS2 strong typing was in fashion. By that, I
            mean the post colon suffix you'll see after variable declarations (var
            myNum:Number = 5, rather than var myNum = 5). But even so, it's a good
            article and should give you a head start.

            As for writing and extending classes, I'll recommend Joey Lott's
            three-part ActionScript 2.0 Primer.

            http://www.person13.com/articles

            Between the two of those, you've got a bit of reading ahead of you, but
            it's well worth it. :)


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


            • 3. Re: XML and Class Implementation?
              ∞_infinite
              Hi la_guitar,

              I think you could use the Loader component to dynamic load those images, the tab names and links could be a Label component with a onRelease event. To use a XML is not so hard, take a look at the documentation here.
              For your animation try the Tween class, this one is note quite well documented, perhaps you'll need some help. If you need search in the forums.
              It doesn't sounds like you need to extend classes by now.

              Instead of using those macromedia live documents links that I posted you can press F1 inside Macromedia Flash to see the documentation.

              • 4. Re: XML and Class Implementation?
                Level 1
                SMB,
                Funny enough, I recently ordered that book because it looked really great. Hasn't arrived yet, but looking forward to it.

                David,
                Thanks for the links.
                I"m always up for a good read.

                infinite,
                That would probably work. Though I'd prefer to use XML so that I don't have to open up Flash to udpate.