New Video Tutorial on ActionScript 3 Advanced XML

This tutorial builds on the last one and gets into more advanced topics such as how to deal with custom namespaces. The finished application consists of a Kuler theme viewer where the user can cycle through the most popular themes simply by clicking on the stage. All of this is done in the Flash IDE without any OOP. Remember that just because all you hear about is OOP and Flex, doesn’t mean that you need to use them to do some pretty complex stuff. Check out the tutorial and play with the finished application below. Click in order to change the theme.

Lee


Commentary

  1. Nico says:

    Hello Lee,

    Do you have a yahoo messenger account? thanks:)
    Nice tutorial.. as always..:)

    Nico

  2. marc thiele says:

    Hi Lee. Can it be, that the Link to the Tutorial is missing (http://www.gotoandlearn.com/) ?

    Cheers,
    marc

  3. corbanb says:

    This is excellent! I am working on something the uses the kuler right now too so its great to see a. AS3 implementation!

  4. Tool says:

    @Nico

    http://www.gotoandlearnforum.com for any questions you might have …

    welcome.

  5. Robert says:

    Great tutorial Lee. Thanks

  6. nibbs says:

    Hi. I’ve got the latest debug player, but when I go to
    http://www.gotoandlearn.com/player.php?id=65
    I get told that I need to install the latest version of the Flash player (?!)

  7. joshspoon says:

    Thanks Lee. I never understood namespaces on paper but now that you show it in action it’s quite easy. Tedious but easy. Also, If anyone is interested in learning how to use this code in PureMVC, check out my post: http://etc.joshspoon.com/2008/02/13/how-to-create-a-puremvc-app-with-actionscript-3/

  8. daniel says:

    cool, I was supprised to see my colours from kuler.

  9. Nice work, I’m working on a AS3 framework to help speed up the development of a project that uses the kuler API.

    You can fined a work in progress at http://code.google.com/p/klib-as3/
    The svn is up to date with a limited functioning version. I have plans to expand it soon.

    Also I was able to reproduce your code with my framework with in 29 lines of code.

    import com.gfxcomplex.klibas3.services.SwatchData.RandomSwatches;
    var randomSwatches:RandomSwatches = new RandomSwatches();
    randomSwatches.addEventListener(Event.COMPLETE, onLoaded);
    randomSwatches.load();
    stage.addEventListener(MouseEvent.CLICK, changeColor);
    var cc:int = 0;
    function onLoaded(e:Event):void {
    drawColors(randomSwatches.swatches[0].color);
    }
    function drawColors(c:Object):void {
    graphics.beginFill(c[0].hex);
    graphics.drawRect(0, 0, 200, 200);
    graphics.beginFill(c[1].hex);
    graphics.drawRect(200, 0, 200, 200);
    graphics.beginFill(c[2].hex);
    graphics.drawRect(400, 0, 200, 200);
    graphics.beginFill(c[3].hex);
    graphics.drawRect(600, 0, 200, 200);
    graphics.beginFill(c[4].hex);
    graphics.drawRect(800, 0, 200, 200);
    }
    function changeColor(e:Event):void {
    if (cc == randomSwatches.swatches.length – 1) {
    cc = 0;
    } else {
    cc++;
    }
    drawColors(randomSwatches.swatches[cc].color);
    }

  10. Connie H. says:

    Thanks for the great tutorial — unfortunately, I can’t get it to work. Double-checked all my code OK, then downloaded your code — and your code behaves the same way, i.e. throws no mistakes, but doesn’t pick up anything either. Could the kuler RSS have changed recently?

  11. pablo botnix says:

    Hey Lee, great tut. Connie H, kuler has changed its feeds so that you now need an api key to access it. request one from kuler and then in the urlrequest add “…&key=(your key)” then it should work fine.

  12. Ony says:

    Hi all

    I am a new user of flash and i need some help if anyone could advice me.

    I have to do a flash that consists of 2 parts,
    One part will load some images from a database , images will be clasified in categories like : top middle and bottom .

    One the second part i have to construct an image based on the selection of the first part.
    For example ..i click one a image from the top category and i want to be displayed on the other part , then i click on an image from the midlle category and again to be displaye , then the same for the bottom , and i have a image constructed on the second part ready to be saved .
    Can anyone help me on how to start or point me to adirection.

    Thanks.

  13. The url to Kuler’s rss has changed to
    http://kuler-api.adobe.com//feeds/rss/get.cfm?listType=rating&itemsperpage=20

    the xml will not load properly with the old URL.

  1. [... This tutorial builds on the last one and gets into more advanced topics such as how to deal with custom namespaces. The finished application consists of a Kuler theme viewer ...]

Leave a Comment