文本字段未在 MovieClip 中显示任何文本

发布于 2024-12-04 20:03:22 字数 1707 浏览 2 评论 0原文

我在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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

叹倦 2024-12-11 20:03:22

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

在此处输入图像描述


您的代码工作正常...

在此处输入图像描述

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.

enter image description here


Your code works fine ...

enter image description here

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文