All pastes #283511 Raw Edit

Anonymous

public text v1 · immutable
#283511 ·published 2006-12-18 12:06 UTC
rendered paste body
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" 
	layout="absolute" 
	pageTitle="Merry Christmas and Happy New Year"
	backgroundGradientColors="[#ffffff,#ffffff]"
	applicationComplete="Start();" >

	<mx:Script>
        <![CDATA[
            private var iCounter:int;
            private var iImg:int;

            
            private function Start():void
            {
            	SetTimer();
                iCounter = 2;
                iImg = 2;
                bkImg2.visible = false;
                bkImg2.load("assets/" + iCounter + ".jpg");
            }
            
            private function SetTimer():void
            {
		var myTimer:Timer = new Timer(10000);
            	myTimer.addEventListener("timer", timerHandler);
            	myTimer.start();
            }
            
            private function timerHandler(event:Event):void
            {
		iCounter = iCounter + 1;
		if(iCounter > 46) { iCounter = 1; }
		if(iImg == 1)
		{
			swapDepths(bkImg2, bkImg1);
			bkImg1.visible = true;
		}
		else
		{
			swapDepths(bkImg1, bkImg2);
			bkImg2.visible = true;
		}	
            }
            
            private function loadImg1():void
            {
		bkImg1.visible = false;
		bkImg1.load("assets/" + iCounter + ".jpg");
		iImg = 1
            }

            private function loadImg2():void
            {
		bkImg2.visible = false;
		bkImg2.load("assets/" + iCounter + ".jpg");
		iImg = 2
            }

	    private function swapDepths(child1:DisplayObject, child2:DisplayObject):void 
	    {
		var index1:uint = getChildIndex(child1);
		var index2:uint = getChildIndex(child2);
			
		setChildIndex(child2, index1);
		setChildIndex(child1, index2);
	    }
        ]]>
    </mx:Script>

	<mx:Fade id="SlowFade" duration="2000"/>

	<mx:Image id="bkImg1" 
		source="assets/1.jpg" 
		visible="true" 
		left="0" top="0" right="0" bottom="0" 
		maintainAspectRatio="false"
		showEffect="{SlowFade}"
		effectEnd="loadImg2()"  />
	<mx:Image id="bkImg2" 
		source="" 
		visible="false" 
		left="0" top="0" right="0" bottom="0" 
		maintainAspectRatio="false"
		showEffect="{SlowFade}"
		effectEnd="loadImg1()"  />
</mx:Application>