AS3 XML Random Banner Rotator

( February 17th, 2009 )

Here is a useful banner ad rotator. It loads a random image or swf file via XML everytime the page loads or is refreshed.

I have included error handlers for the XML file and banners.

(This file will open in Flash CS3) (Preview File)
Get Source


6 Comments for “AS3 XML Random Banner Rotator”

  1. Hi there,
    Super post, Need to mark it on Digg

    Have a nice day
    Saurooon

  2. This was super useful for a project I am working on – thanks! One thing I noticed that was interesting, that if a SWF file that gets loaded as a banner has a reference to stage.stageWidth, or stage.stageHeight (as in placing the x or y location of a movieclip inside the file), it would thrown a 1099 error, saying “cannot reference a null object or method.” I finally figured out that because the SWF that loads the banners has its own stage width and height properties, referencing stage width and height inside one of the banners would not “fly.” Changing it to a fixed x or y location made the problem go away. From that point on, this code was a breeze to use – huge thanks, it was just what I needed and was wondering how I was going to create (beyond my current skills)!

  3. Hi David
    I’m glad you found what you needed.
    I will look at the code and place a solution here soon.
    Look out for it.
    Rowan

  4. Hello and thank you for posting such a great resource.

    Your website is riddled with great stuff…very appreciated. I’m new to Flash but even newer to AS3 so please bear with me.

    I have downloaded the banner rotator and wished to use it as a footer however I’m finding it difficult to obtain the result I’m looking for.

    I have messed around with the action script and the text fields yet the results always show the banner playing in the upper left.

    I’m curious what is necessary to result in the banners playing in the lower left corner?

    Any help provided would be extremely appreciated.

    All the best and again, great job on this valuable resource.

  5. Assuming that you want to place the Flash file at the bottom left of the web page, you do not need to edit any code related to the banner system.

    You should simply place the banner at the bottom of your tag and align it left.

    Do you need an example?

  6. Хм… Очень даже ничего.

Post your comment here:

« | »