im building this interface in FLASH CS5, where i want to place a digital clock, i created a MovieClip InstanceName “RELOJ” in that MovieClip i have two layers, one with two Text Fields that are going to display Time and the other the Date, and on the other layer is the actionscript (AS3) of the whole clock and date.
ok, now i place that movieclip on my Main TimeLine, i play the swf but i dont see the clock working.
I have tried placing an Actions layer on my main timeline and writing “RELOJ.play()” but nothing…
How do i play that MovieClip?
UPDATE: This is the code inside the MovieClip. The Fonts are Embedded.
dateDisplay.addEventListener(Event.ENTER_FRAME,showTime);
diaDisplay.addEventListener(Event.ENTER_FRAME,showDia);
function showTime(event:Event):void {
var myTime:Date = new Date();
var theSeconds=myTime.getSeconds();
var theMinutes=myTime.getMinutes();
var theHours=myTime.getHours();
var ampm:String;
if (theHours>=12) {
ampm="pm";
} else {
ampm="am";
}
if (theHours>=13) {
theHours=theHours-12;
}
if (String(theMinutes).length == 1) {
theMinutes="0"+theMinutes;
}
if (String(theSeconds).length == 1) {
theSeconds="0"+theSeconds;
}
dateDisplay.text =theHours+":"+theMinutes+":"+theSeconds+" "+ampm;
}
function showDia(event:Event):void {
var myDia:Date = new Date();
var dayText:String;
var theDia=myDia.getDay();
var theFechaDia=myDia.getDate();
if(theDia == 0) {
dayText = "Domingo";
} else if(theDia == 1) {
dayText = "Lunes";
} else if(theDia == 2) {
dayText = "Martes";
} else if(theDia == 3) {
dayText = "Miercoles";
} else if(theDia == 4) {
dayText = "Jueves";
} else if(theDia == 5) {
dayText = "Viernes";
} else if(theDia == 6) {
dayText = "Sabado";
}
diaDisplay.text =dayText+" "+theFechaDia;
}
Select your textfield. Make it dynamic. Select what characters you want to embed. Test again. If nothing changes, add som graphics to the movieclip so you know it shows.
Your code works fine …