AS3 - 跟踪 - 点击按钮 [英] AS3 - Trace - Click button
本文介绍了AS3 - 跟踪 - 点击按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想点击一个按钮,并描绘出一个数字1搬上了舞台/同样的场景。
I am trying to click on a button and trace out a number "1" onto the stage/same scene.
我有这样的code:
button1.addEventListener(MouseEvent.CLICK, myClickReaction1);
function myClickReaction1 (e:MouseEvent):void{
trace("1");
}
但它的痕迹到闪光灯的输出,而不是到了现场。
BUT it traces onto the output of flash and not onto the scene.
请帮忙
感谢
推荐答案
跟踪(1);
会去它的目的是用于调试的输出面板
trace("1");
will go to the output panel it is intended for debugging.
如果你想看到在舞台上的东西,你需要创建一个文本字段
并设置它的文本
属性为任何你想要的。
If you want to see something on the stage, you will need to create a TextField
and set it's text
property to whatever you want.
button1.addEventListener(MouseEvent.CLICK, myClickReaction1);
function myClickReaction1 (e:MouseEvent):void{
var tf:TextField = new TextField();
tf.text = "1";
addChild(tf);
}
这篇关于AS3 - 跟踪 - 点击按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文