Actionscript 3 - Written by Artluvr on Sunday, November 30, 2008 22:25 - 4 Comments

XML based banner rotator – Actionscript 3, Flash CS3


DEMO HERE

This is a simple xml based, banner rotator. It is made with Flash CS3 and AS3. Fully customizable and this means that you can change the following:

Fron inside BannerRotator.as file

const BANNER_NUMBER_SPACING:Number = 30; //the spacing between the number boxes
const BANNER_NUMBER_ALPHA:Number = 0.5; //the initial alpha of the number boxes
const BANNER_SHOW_TRANSITION:Number = 0.5; //the duration of the transition when the banner will be shown
const DELAY:Number = 6000; //after how many miliseconds the next banner will be shown
const LOADING_COLOR:uint=0×000000; //the color of the loading bar
const LOADING_ALPHA:Number=0.5; //the alpha of the loading bar

From inside BannerNumber.as

const NUMBER_FONT:String = “Arial”; //the font of the banner’s number
const NUMBER_FONT_SIZE:Number = 12; //the font size of the banner’s number
const NUMBER_FONT_COLOR:uint = 0xffffff; //the font color of the banner’s number
const NUMBER_BG_COLOR:uint = 0×000000; //the color of the number background
const NUMBER_BLUR_ALPHA:Number = 0.5; //the initial alpha of banner’s number
const NUMBER_TRANSITION_TIME:Number = 0.3; //the duration of the transition when you put your mouse over a banner’s number

From inside the BannerImage.as

const IMAGE_TITLE_FONT:String = “Arial”; //the title font
const IMAGE_TITLE_FONT_SIZE:Number = 16; //the title font size
const IMAGE_TITLE_BOLD:Boolean = false; //is the title bold?
const IMAGE_TITLE_COLOR:uint = 0xffffff; //the color of the title
const TITLE_X:Number = 10; //the X offset of the title
const TITLE_Y:Number = 10; //the Y offset of the title
const TITLE_MAXIMUM_WIDTH:Number = 480; //the titles maximum width

Fron inside the XML file

URL redirection by clicking on each banner
Descriptions

The xml structure looks like this:

<banner title=”Welcome to Artluvr.com” file=”banners/1.jpg” url=”http://www.amazon.com”></banner>

Finally, you display it by simply writing the following code:

import br.BannerRotator;

var brot:MovieClip = new BannerRotator(500,247, “”banners.xml”);
addChild(brot);

The above code will create a banner with width 500px, height 247px and will read the file “banners.xml”.

Price: € 6



Share and Enjoy:

4 Comments

You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

German Moran
Feb 20, 2009 23:27

I want the URL to load in the same window as the Flash Animation. Below is the code I changed in BannerImage.as

private function banner_CLICK(e:MouseEvent):void{
navigateToURL(new URLRequest(this._url), “_self”);
}

However, the code is not reaching that area because when I change this._url, it still goes to the URL assigned in the XML Document.

Let me know if loading the URL in the same window is possible…

Thank you in advance.

Artluvr
Feb 22, 2009 10:55

Mr. Moran you did it correctly, and it worked fine for me. And it opened the assigned, from the XML, URL

RuiS
Apr 15, 2009 12:02

Can i change width 500px, height 247px for anothers dimensions?

Artluvr
Apr 18, 2009 14:25

@RuiS, ofcourse you can.

Leave a Reply

Comment

Most Popular Content






Image Galleries


Menus & Buttons


Utilities


Freebies