0

我在 FLASH CS5 中构建这个界面,我想在其中放置一个数字时钟,我在那个 MovieClip 中创建了一个 MovieClip InstanceName“RELOJ”,我有两层,一层有两个文本字段,它们将显示时间,另一个是日期,另一层是整个时钟和日期的动作脚本(AS3)。

好的,现在我将那个movieclip 放在我的主时间线上,我播放swf 但我看不到时钟工作。

我尝试在我的主时间线上放置一个动作层并编写“RELOJ.play()”,但什么也没有……

我如何播放该影片剪辑?

更新:这是 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;

 }
4

1 回答 1

0

选择您的文本字段。让它充满活力。选择要嵌入的字符。再次测试。如果没有任何变化,请将 som 图形添加到影片剪辑中,以便您知道它会显示。

在此处输入图像描述


您的代码工作正常...

在此处输入图像描述

于 2011-09-17T17:00:39.543 回答