本文介绍了Flash CS4,非活动按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我运行这段代码时没有语法错误。我检查了操作面板中的变量和功能,它工作正常。但是,当我从操作面板删除代码,并尝试运行.as文件时,我没有任何反应,当我点击按钮。
这里是我的代码:
$ $ p $
$ import flash.display。*;
import flash.events.MouseEvent;
import flash.text。*;
import flash.display.MovieClip;
公共类U1A4_Sommeil扩展MovieClip
{
private var monMessage:TextField = new TextField;
private var maMiseEnForme:TextFormat = new TextFormat;
public function U1A4_Sommeil()
{
btnSoumettre.addEventListener(MouseEvent.CLICK,Calcule);
$ b private function Calcule(event:MouseEvent):void
{
maMiseEnForme.font =Arial;
maMiseEnForme.size = 20;
maMiseEnForme.color = 0xFF0000;
maMiseEnForme.bold = true;
monMessage.autoSize = TextFieldAutoSize.LEFT;
monMessage.defaultTextFormat = maMiseEnForme;
monMessage.x = 260;
monMessage.y = 260;
monMessage.border = true;
var intAn:int = int(txtAn.text) - int(txtAnNaissance.text);
var intMois:int = int(txtMois.text) - int(txtMoisNaissance.text);
var intJour:int = int(txtJour.text) - int(txtJourNaissance.text);
var strResultat:String =(Tu esagéde+(intAn * 365 + intMois * 30 + intJour)+jours。
+\\\
+Tu as dormi+((intAn * 365 + intMois * 30 + intJour)* 8)+heures
+\ n
+depuis ta naissance。
monMessage.text = strResultat;
addChild(monMessage);
$ div class =h2_lin>解决方案
文件菜单> 动作设置... 然后:
stack.imgur.com/paw1A.pngalt =在这里输入图片描述>
希望能帮上忙。
I have no syntax errors when I run this code. I checked the variables and the functions in the action panel and it works fine. But, when I remove the codes from the action panel, and try to run the .as file nothing happens when I click the button.Here's my code:
package
{
import flash.display.*;
import flash.events.MouseEvent;
import flash.text.*;
import flash.display.MovieClip;
public class U1A4_Sommeil extends MovieClip
{
private var monMessage:TextField = new TextField;
private var maMiseEnForme: TextFormat = new TextFormat;
public function U1A4_Sommeil ()
{
btnSoumettre.addEventListener(MouseEvent.CLICK,Calcule);
}
private function Calcule (event:MouseEvent):void
{
maMiseEnForme.font= "Arial";
maMiseEnForme.size = 20;
maMiseEnForme.color = 0xFF0000;
maMiseEnForme.bold = true;
monMessage.autoSize = TextFieldAutoSize.LEFT;
monMessage.defaultTextFormat = maMiseEnForme;
monMessage.x = 260;
monMessage.y = 260;
monMessage.border = true;
var intAn : int = int(txtAn.text) - int(txtAnNaissance.text);
var intMois : int = int(txtMois.text) - int(txtMoisNaissance.text);
var intJour : int = int(txtJour.text) - int(txtJourNaissance.text);
var strResultat : String = ("Tu es agé de "+ (intAn*365+intMois*30+intJour) + " jours."
+ "\n"
+ "Tu as dormi " + ((intAn*365 + intMois*30 + intJour)*8) + " heures"
+ "\n"
+ "depuis ta naissance.");
monMessage.text = strResultat;
addChild (monMessage);
}
}
}
解决方案
I think that your have just to add your U1A4_Sommeil
class as your document class using your document properties :
Or, from File Menu > ActionScript Settings... then :
Hope that can help.
这篇关于Flash CS4,非活动按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!