文本字段未在 MovieClip 中显示任何文本
我在FLASH CS5中构建这个界面,我想在其中放置一个数字时钟,我在该MovieClip中创建了一个MovieClip实例名称“RELOJ”,我有两层,一层有两个文本字段,将显示时间,另一层是日期,另一层是整个时钟和日期的动作脚本(AS3)。
好的,现在我将该影片剪辑放在我的主时间线上,我播放了 swf,但我没有看到时钟在工作。
我尝试在主时间轴上放置一个动作图层并编写“RELOJ.play()”,但什么也没有...
我如何播放该 MovieClip?
更新:这是MovieClip内的代码。字体是嵌入的。
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;
}
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;
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
选择您的文本字段。使其充满活力。选择您要嵌入的字符。再次测试。如果没有任何变化,请将一些图形添加到影片剪辑中,以便您知道它会显示。
您的代码工作正常...
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 ...