Hello people I have been creating a flash front page using CS5 and AS3, I am new to AS3 so please be patient with me.
I created a typewriter style effect using this AS3:
This code works fine at this point...... I then add this section of code to add a countdown timer:Code:var myString2:String = " Forums"; var myArray2:Array = myString2.split(""); addEventListener(Event.ENTER_FRAME, frameLooper2); function frameLooper2(event:Event):void { if (myArray2.length > 0) { tf2.appendText(myArray2.shift()); } else { removeEventListener(Event.ENTER_FRAME, frameLooper2); } }
This code also works fine by itself but not together, please can someone help locate the conflicting issue.Code:this.onEnterFrame = function() { //Set the variables: var today:Date = new Date(); var currentYear = today.getFullYear(); var currentTime = today.getTime(); //Now, here is where you can set the countdown date. //The format for dates in flash are: Year, Month (0-11, 0 being January), Day. //To countdown to the current year, use 'CurrentYear' or for a specific year, use '2011', '2012' etc. var targetDate:Date = new Date(currentYear,11,25); var targetTime = targetDate.getTime(); //Here's all the maths. Don't edit this unless you know what you're doing! var timeLeft = targetTime - currentTime; var sec = Math.floor(timeLeft/1000); var min = Math.floor(sec/60); var hrs = Math.floor(min/60); var days = Math.floor(hrs/24); sec = String(sec % 60); if (sec.length < 2) { sec = "0" + sec; } min = String(min % 60); if (min.length < 2) { min = "0" + min; } hrs = String(hrs % 24); if (hrs.length < 2) { hrs = "0" + hrs; } days = String(days); var counter:String = days + ":" + hrs + ":" + min + ":" + sec; time_txt.text = counter; }
I have uploaded the fla to http://www.tempfiles.net/download/20...385/index.html as it is too big to attach.
Thanks in advance!




Reply With Quote