Rotating Banner - Save $10

stop();

/*
=======================================
NOTE: ALL SWF FILES must b AS3 exported
http://www.beautifycode.com/the-finer-art-of-loading-2-handling-multiple-swfs#snippet
=======================================
*/
import flash.events.*;
import flash.display.*;
import flash.events.Event;
import flash.events.ProgressEvent;
import flash.text.TextField;

import fl.motion.Color;
import flash.geom.ColorTransform;
var cTransform:ColorTransform = transform.colorTransform;
var _tintColor:Color;
var _Colored:Color;



var i:uint;
var myXML:XML = new XML();
var XML_URL:String = "banner.xml";
var indexSWF = 0;

var frames:Number;
var _swfLoader:Loader;
var _swfRequest:URLRequest;
var _swfClipsArr:Array = new Array();
var _swfTempClip:MovieClip;
var _loadedSWFs:int;
var _swfToAdd:MovieClip;
var index = 0;

var myXMLURL:URLRequest = new URLRequest(XML_URL);
var myLoader:URLLoader = new URLLoader(myXMLURL);
myLoader.addEventListener("complete", xmlLoaded);

function xmlLoaded(event:Event):void
{

myXML = XML(myLoader.data);

/*
=============
METHOD - I
=============
*/
//call link in XML Banner tag
//Converting XML LIST into XML Array
var bannerList:XMLList = myXML.banner.link;
var BannerArray:Array = new Array();

for each (var tempXML:XML in bannerList)
{
BannerArray.push(tempXML);
}

/*
=============
METHOD - II
=============
*/
//var BannerArray:Array = new Array("00.swf", "01.swf", "02.swf");

/*
=============
METHOD - III
=============
*/

/* var arrayLoader:Loader = new Loader;
var thisMovieClip:MovieClip;
var frames:Number
var swf_URL:String = "rbd_fastsaver.swf";
var swfURL:URLRequest = new URLRequest(swf_URL);
arrayLoader.load(swfURL)*/


/*
=============
*/

startLoading(BannerArray);

function startLoading(pathArr:Array):void {
_swfLoader = new Loader();
_swfRequest = new URLRequest();
loadSWF(pathArr[0]);
//trace (loadSWF(pathArr[0])); //rbd_generic.swf
}

function loadSWF(path:String):void {
//checking contentLoaderInfo
setupListeners(_swfLoader.contentLoaderInfo);


_swfRequest.url = path;
//trace(_swfRequest.url);//*.swf
_swfLoader.load(_swfRequest);

}

function setupListeners(dispatcher:IEventDispatcher):void {

dispatcher.addEventListener(Event.COMPLETE, onSwfComplete);
dispatcher.addEventListener(ProgressEvent.PROGRESS, currentSwfProgress);
}


function currentSwfProgress(event:ProgressEvent):void {
var _perc:int = (event.bytesLoaded / event.bytesTotal) * 100;
// swfPreloader.percentTF.text = _perc + "%";
}


//
function onSwfComplete(event:Event):void {
event.target.removeEventListener(Event.COMPLETE, onSwfComplete);
event.target.removeEventListener(ProgressEvent.PROGRESS, currentSwfProgress);

_swfTempClip = event.target.content;
_swfTempClip.customID = _loadedSWFs;

//trace("ID: " + _swfTempClip.customID);

_swfClipsArr.push(_swfTempClip);

//trace(_loadedSWFs);

if(_loadedSWFs 0)
{
var data2 = "banner_btn" + index ;
_swfToAdd = _swfClipsArr[index];

trace(String(data2));

_tintColor = new Color();
_tintColor.setTint (0,0);

banner_btn0.transform.colorTransform = _tintColor;
banner_btn1.transform.colorTransform = _tintColor;
banner_btn2.transform.colorTransform = _tintColor;
banner_btn3.transform.colorTransform = _tintColor;
banner_btn4.transform.colorTransform = _tintColor;
banner_btn5.transform.colorTransform = _tintColor;

if (this[String(data2)]){


_Colored = new Color();
_Colored.setTint (0x000000,1);
this[String(data2)].transform.colorTransform = _Colored;
//banner_btn2.transform.colorTransform = _Colored;
}





}

if (index >= _swfClipsArr.length)
{
index = 0;
banner_btn0.transform.colorTransform = _Colored;
_swfToAdd = _swfClipsArr[index];

}
movie1.removeChildAt(movie1.numChildren-1);
_swfToAdd.gotoAndStop(_swfToAdd.totalFrames);
_swfToAdd.gotoAndPlay(1);
movie1.addChild(_swfToAdd);
_swfToAdd.gotoAndPlay(1);


}

}







0 comments:

Post a Comment