如何使用MX 2004的CSS功能

來源:互聯網
上載者:User
css

  今天給大家介紹一下關於CSS的問題,希望大家學會怎麼使用CSS。

  步驟1:

  在情境上建立一個動態問題欄, 設定執行個體名叫output,設定為multiline。

  步驟2:

  在第一個frame輸入以下的:

var myStyle = new TextField.StyleSheet();
var txt = "<p class=''c1''>www.webjx.com 1</p><p class=''c2''>www.webjx.com 2</p>";    //注意這裡的class, 他會根據你css檔案中設定的方式呈現
          myStyle.load("style.css");
          myStyle.onLoad = function(loaded) {
                   if (loaded) {
                            output.styleSheet = myStyle;
                            output.text = txt;
                   } else {
                            output.text = "CSS file not found !_!";    //CSS載入不成功
                   }
            };

  步驟3:

  開啟記事本,輸入以下代碼存為style.css, 並和flash檔案放在同一目錄下

.c1 {
    font-family: Arial, Helvetica, sans-serif;
    font-size: 18px;
    font-weight: bold;
    color: #000000;
}

.c2 {
    font-family: Arial, Helvetica, sans-serif;
    font-size: 24px;
    font-weight: bold;
    color: #FF6600;
}

  步驟4:

  發布並測試, 需要使用html來看才可以... 不然會顯示無法載入CSS...:)



相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.