Emotioned.com

Ian Cremona

Flash CS4 AS3 XML reader and Tween source code

December20

Chilipoker Client Banner,in 7 Languages. Read more for code and source files and full size

The FLA:

//CLIENT PROMOTION
import fl.transitions.Tween;
import fl.transitions.easing.*;
import flash.events.MouseEvent;
import flash.events.TimerEvent;
import flash.utils.Timer;
//import flash.display.*;
 
//import mcIcon;
 
var promoNum:Number=0;
var tweendelay:Number=10;// in miliseconds
var inTween:Tween;
var moveEnd:Number;
var outTween:Tween;
var xTween:Tween;
var yTween:Tween;
//var addTest:MovieClip;
var btnNext:btnTween = new btnTween();
var btnPrev:btnTween = new btnTween();
var mcTest:addTest = new addTest();
var _mcCorners:mcCorners = new mcCorners();
var _mcShadow:mcShadow = new mcShadow();
var _mcBotttoolbar:mcBotttoolbar = new mcBotttoolbar();
var nextTimer:Timer=new Timer(10000);
var stageWidth_num:Number = new Number();
 
//get stage width
stageWidth_num=stage.stageWidth;
trace("stageWidth_num = " + stageWidth_num);
 
addChild(_mcBotttoolbar);
_mcBotttoolbar.y=42.7;
 
addChild(_mcShadow);
//_mcShadow.x = 20;
 
addChild(btnNext);
btnNext.x=600;//565;
btnNext.y=0;//46;
btnNext.addEventListener(MouseEvent.CLICK, navigate);
btnNext.addEventListener(MouseEvent.ROLL_OVER, stopTimer);
btnNext.addEventListener(MouseEvent.ROLL_OUT, startTimer);
nextTimer.addEventListener(TimerEvent.TIMER, navigateTimer);
//btnNext.addEventListener(MouseEvent.CLICK, fadeIn);
 
addChild(btnPrev);
btnPrev.x=0;//535;
btnPrev.y=0;//46;
btnPrev.gotoAndStop(2);
btnPrev.addEventListener(MouseEvent.ROLL_OVER, stopTimer);
btnPrev.addEventListener(MouseEvent.ROLL_OUT, startTimer);
btnPrev.addEventListener(MouseEvent.CLICK, navigate);
 
addChild(_mcCorners);
 
getChildByName("promotion1").visible=false;
 
function navigateTimer(event:TimerEvent):void {
	promoNum=promoNum+1;
	if (promoNum>=promotionsXML.promotion.length()) {
		promoNum=0;
	}
	trace("promonum="+promoNum);
	moveEnd = -(_mcContent.width*promoNum-100);//moveEnd = -(((this.getChildByName("promotion"+(promoNum))).width)-100);
	trace("moveend"+moveEnd);
 
	getChildByName("promotion1").visible=true;
 
	for (var i:Number = 0; i < promotionsXML.promotion.length(); i++) {
		xTween = new Tween(this.getChildByName("promotion"+i),"x",Back.easeOut,(this.getChildByName("promotion"+i)).x,moveEnd,tweendelay);
		trace(moveEnd);
	}
}
 
function startTimer(event:MouseEvent):void {
	nextTimer.start();
}
 
function stopTimer(event:MouseEvent):void {
	nextTimer.stop();
}
 
function navigate(event:MouseEvent):void {
	if (event.target==btnPrev) {
		promoNum=promoNum-1;
		if (promoNum<=-1) {
			promoNum=promotionsXML.promotion.length()-1;
		}
		trace("promonum="+promoNum);
		moveEnd = -(_mcContent.width*promoNum-100);//moveEnd = -(((this.getChildByName("promotion"+(promoNum))).width)-100);
		trace("moveend"+moveEnd);
 
		getChildByName("promotion1").visible=true;
 
		for (var i2:Number = 0; i2 < promotionsXML.promotion.length(); i2++) { 			xTween = new Tween(this.getChildByName("promotion"+i2),"x",Back.easeOut,(this.getChildByName("promotion"+i2)).x,moveEnd,tweendelay); 			trace(moveEnd); 		} 	} else { 		promoNum=promoNum+1; 		if (promoNum>=promotionsXML.promotion.length()) {
			promoNum=0;
		}
		trace("promonum="+promoNum);
		moveEnd = -(_mcContent.width*promoNum-100);//moveEnd = -(((this.getChildByName("promotion"+(promoNum))).width)-100);
		trace("moveend"+moveEnd);
 
		getChildByName("promotion1").visible=true;
 
		for (var i:Number = 0; i < promotionsXML.promotion.length(); i++) {
			xTween = new Tween(this.getChildByName("promotion"+i),"x",Back.easeOut,(this.getChildByName("promotion"+i)).x,moveEnd,tweendelay);
			trace(moveEnd);
 
		}
	}
}
 
function fadeIn(event:MouseEvent):void {
	for (var i:Number = 0; i < promotionsXML.promotion.length(); i++) {
		inTween=new Tween(this.getChildByName("promotion"+i),"alpha",Bounce.easeIn,0,1,1,true);
	}
}
 
function fadeOut(event:MouseEvent):void {
	for (var i:Number = 0; i < promotionsXML.promotion.length(); i++) {
		outTween=new Tween(this.getChildByName("promotion"+i),"alpha",Bounce.easeIn,1,0,1,true);
	}
}
 
nextTimer.start();
 
xTween=new Tween(this.getChildByName("promotion0"),"x",Back.easeOut,500,100,10);

The Banner Language Class:

package
 
{
 
import flash.display.MovieClip;
 
//import flash.net.URLLoader;
 
import mcPromotion;
 
import mcContent;
 
import addTest;
 
public class BannerClassEN extends MovieClip
 
{
 
private var imagenumber:Number;
 
//private var imageRequest:URLRequest = new URLRequest("test.jpg");
 
private var promotion:mcPromotion; 
 
private var _mcContent:mcContent;
 
private var _mcContentX:Number;
 
private var _mcContentY:Number;
 
private var loadImage:String;
 
//private var addBox:addTest = new addTest();
 
// If anyone manages to load the XML dynamically please send the source files to iancremona@gmail.com
 
////==============================================================================================================================================================================================================================================================================================================================================================================================================================================
 
////==============================================================================================================================================================================================================================================================================================================================================================================================================================================public var promotionsXML:XML = 
 
	Chilipoker will soon see its Two Billionth Hand dealt and to celebrate we have prepared a stunning promotion giving away up to $170,000 to participants.
 
	Thanks to our Happy Liz-Mas promotion, you can get into the big tournaments, win a poker table and much much more!
 
	Welcome to this monthly Challenge, a cash table contest where you will qualify by just playing 10,000 raked hands!!
 
	Chilipoker proposes to you a new challenge for this month, a Sit&Go race where you just need to play a minimum of 40 Sit & Go's during the whole month
 
	ChiliPoker proudly offers all new depositors a 100% Cash Bonus up to $600. In order to receive your bonus, enter our special code when registering.
 
	At Chilipoker players rule! Chilipoker is the only poker room that allows you to set the pace of your bonus!
 
	Deposit Now! Chilipoker.com brings a special promotion for all its new depositors! Prepare your money and stop looking because nobody gives you more than the spiciest poker room around!
 
	Welcomed with a luxury limo and free flowing champagne, a concierge service at your disposal throughout the duration of your stay and a reduced price for Chilipokeru sers.
 
	For the first time a poker website is offering players total control over their poker activities.
 
	ChiliPoker offers 6 exclusive VIP membership levels, providing you with special rewards and added bonuses. The more FPP points earned the faster you move up the ranks.
 
	You earn FPPs each time you play with Chilipoker, whether it’s at the Poker Tables or in the Casino. They allow you to earn rewards based on your loyalty to Chilipoker.
 
	Make it even more exciting at Chilipoker! Play the latest in Casino Games and earn lots of extra FPPs!
 
	Chilipoker is holding an exclusive online league with Goldenzone Poker Forum and sending away 15 sponsorships to play at China Poker Carnival in December 2009!
 
	At ChiliPoker we do not support injustice. Losing with four of a kind can be unpleasant, sure many will say "that's poker” but it’s still an emotional let down.
 
	Win the ChiliPoker Exclusive Jackpot by participating in our SnG tournaments. All you need to do is win a specific number of Sit and Go’s tournaments (SnGs) consecutively, and collect up to $50.000!
 
	Tell your friends about us! We have chosen a very simple formula to show you our gratitude: Money for everyone involved.
 
	For the first time ever, an online poker site is finally making it possible to directly access any money you make from poker to buy what you want when you want.
 
////==============================================================================================================================================================================================================================================================================================================================================================================================================================================
 
////==============================================================================================================================================================================================================================================================================================================================================================================================================================================
 
public function BannerClassEN()
 
{
 
loadXML()
 
createPromos()
}
private function loadXML():void
 
{
 
trace(promotionsXML.children()[0]);
 
}
private function createPromos():void
 
{
 
_mcContentX = 208; // I don't know why I had to do this! I guess the MC positioning needs amending
 
_mcContentY = 31.5; //Extra
for(var i:Number = 0; i < promotionsXML.promotion.length(); i++)
 
{
 
promotion = new mcPromotion();
 
addChild(promotion);
 
_mcContent = new mcContent();
 
promotion.setType(_mcContent);
 
_mcContent.x = _mcContentX;
 
_mcContent.y = _mcContentY; 
 
_mcContentX += _mcContent.width;
 
// ------------------------------
 
// I would like to add image here
 
//_mcContent.promoThumb.alpha = .2;
 
// ------------------------------
 
_mcContent.promoTxt.text = promotionsXML.children()[i];
 
promotion.name = "promotion" + i;
 
trace(promotionsXML.children()[i]);
loadImage = promotionsXML.children()[i].attribute("source");
 
trace("URLURL == "+promotionsXML.children()[i].attribute("urlLink"));
 
_mcContent._URLLink=promotionsXML.children()[i].attribute("urlLink");
 
_mcContent.imageSrc=loadImage;
 
trace("loadImage"+ loadImage);
 
//_mcContent.promoThumb
 
//imagenumber = loadImage;
 
trace("imagenumber"+ imagenumber);}
}
 
}
}

The Promo Button Class:

//CLIENT PROMOTION
package
{
	import flash.display.MovieClip;
	import flash.events.MouseEvent;
	//import flash.display.Loader;
 
	public class PromoButton extends MovieClip
	{
		private var _type:*;
		private var _icon:*;
		//private var _origXScale:Number;
		//private var _origYScale:Number;
 
		public function PromoButton()
		{
			//_origXScale = this.scaleX;
			//_origYScale = this.scaleY;
			this.buttonMode=true;
			this.addEventListener(MouseEvent.ROLL_OVER, grow);
			this.addEventListener(MouseEvent.ROLL_OUT, shrink);
			this.addEventListener(MouseEvent.CLICK, bright);
 
		}
			private function bright(event:MouseEvent):void
		{
 
			//this.scaleX *= .8;
			//this.scaleY *= .8;
			this.alpha = .8;
			//trace("promotionsXML.promotion.length()" + promotionsXML.promotion.length());
			//trace("event.target = " + event.target);
			//trace("event.target.id = " + event.target.id);// Get Item ID - need children
			trace("this.parent = " + this.parent);
			trace("this.parent.parent = " + this.parent.parent);
			trace("this.parent.parent.parent = " + this.parent.parent.parent);
			//trace("this.parent.parent.parent.parent = " + this.parent.parent.parent.parent);
			//trace("this.parent.parent.parent.parent.parent = " + this.parent.parent.parent.parent.parent);
 
		}
		private function grow(event:MouseEvent):void
		{
			//this.scaleX *= .8;
			//this.scaleY *= .8;
			this.alpha = .6;
			this.buttonMode = true;
		}
		private function shrink(event:MouseEvent):void
		{
			//this.scaleX = _origXScale;
			//this.scaleY = _origYScale;
			this.alpha = 1;
		}
 
		public function setType(type:*):void
		{
			_type = type;
			addChild(_type);
			//for(var i:Number = 0; i < 19; i++)
			//{
			_type.name = "loader_mc" ;
			//};
		}
 
	}
}

Share and Enjoy:
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks

No related posts.

Related posts brought to you by Yet Another Related Posts Plugin.

posted under Design

Email will not be published

Website example

Your Comment:

Spam Protection by WP-SpamFree

 

What I'm Doing...

Posting tweet...

 

December 2009
M T W T F S S
« Nov   Jan »
 123456
78910111213
14151617181920
21222324252627
28293031