2013-05-27 63 views
0
import flash.display.MovieClip; 
import flash.events.MouseEvent; 
import flash.text.StyleSheet; 

public class BattleActionButton extends MovieClip 
{ 
    public var buttonID:int = 0; 

    var css:StyleSheet = new StyleSheet(); 
    css.parseCSS('battleactionbutton { font-family: Pixelade; font-size: 4px; text-align: justify; color: #000000;}'); 

上面我粘貼了整個班級給我的問題。這是我第一次在AS3中使用CSS,所以我想我在那裏有一個問題。定義樣式表時出現錯誤1120

回答

0

嘗試parseCSS呼叫移動到構造函數,像這樣:

var css:StyleSheet = new StyleSheet(); 

public function BattleActionButton() { 
    css.parseCSS('battleactionbutton { font-family: Pixelade; font-size: 4px; text-align: justify; color: #000000;}'); 
}