国产黄色免费网站,人人干人人干人人干,免费大黄网站在线看,国产情侣一区二区三区,99精品国产福利免费一区二区,国产亚洲成归v人片在线观看,伊人88

2023信創(chuàng)獨(dú)角獸企業(yè)100強(qiáng)
全世界各行各業(yè)聯(lián)合起來(lái),internet一定要實(shí)現(xiàn)!

Flash MX 2004新特性實(shí)例學(xué)習(xí)六

2004-02-12 eNet&Ciweek

  實(shí)例七、Text Enhancements

  一、涉及特性

  在實(shí)例中,主要涉及在Flash MX 2004中引用和顯示外部的css文件和html文件。這些都是在Flash MX 2004中才有的新特性,應(yīng)用也非常方便。本實(shí)例在Flash MX 2004中的操作非常簡(jiǎn)單,不過(guò)這正從側(cè)面反映了它的功能強(qiáng)大。

  二、制作過(guò)程

  1、建立一個(gè)文件,命名為sample.css。其內(nèi)容如下:

  

  headline {

   font-family: Arial,Helvetica,sans-serif;

   font-size: 16px;

   font-weight: bold;

   display: block;

  }

  subheadline {

   font-family: Arial,Helvetica,sans-serif;

   font-size: 13px;

   font-weight: bold;

   display: block;

  }

  mainBody {

   font-family: Arial,Helvetica,sans-serif;

   font-size: 10px;

   display: block;

  }

  biline {

   font-family: Arial,Helvetica,sans-serif;

   font-size: 11px;

   font-style: italic;

   display: inline;

  }

  A {

   font-family: Arial,Helvetica,sans-serif;

   color:cccccc;

   font-size: 10px;

   display: inline;

   text-decoration:underline;

  }

  上面的css文件中,中括號(hào)里面的是對(duì)應(yīng)的屬性。比如font-family是字符集,font-size是字體大小,display是字體的顯示方式,等等。只要有簡(jiǎn)單的網(wǎng)頁(yè)制作知識(shí)就應(yīng)該可以看懂的。

  2、新建一個(gè)文件,命名為sample.html,其內(nèi)容如下:

  

  

   Giant Sea Lion Spotted

   Citizens scared, amazed

  

  

  Today - Our City A giant sea lion was spotted today rampaging around the city's main square, scaring thousands of innocent people just out for a daily stroll in the beautiful downtown district.

  No injuries were reported after the animal's two-hour assault of the shopping district famous for it's sea lion purses and shoes, also known as the "sea lion district". Witnesses said the creature came out of the ocean near the Burger King at 42nd and 1st Avenue, startling many and stalling traffic.

  "The animal caused nearly four million dollars of damage to the neighborhood," said Joseph Valente, owner of "Sea Lions R' Us" at 43rd and 2nd. Onlookers to the scene said that the sea lion appeared ornery, but otherwise in good spirits.

  Officials are uncertain as to when, if ever, the sea lion may return.Click here for more.


  

  這個(gè)文件的內(nèi)容是應(yīng)用了前面所創(chuàng)建的css格式的html文件。(嚴(yán)格來(lái)說(shuō),此文件更像是一個(gè)xml文件。)

  

  
   3、將一個(gè)名為sample.jpg的圖片放到跟第一、二步所創(chuàng)建的文件的同一目錄中。

  4、新建一個(gè)Flash MX 2004的文件,保存在跟前面所創(chuàng)建的文件所在的目錄中。

  5、用文本工具在場(chǎng)景中拉一個(gè)文本輸入框,命名為content。在屬性面板上設(shè)置如1所示。

  6、在TimeLine中新建一個(gè)圖層,命名為Action,在此層的Action面板上面增加如下語(yǔ)句:

  

  /* Copyright 2003 Macromedia, Inc. All rights reserved.

  The following is Sample Code and is subject to all restrictions

  on such code as contained in the End User License Agreement

  accompanying this product.

  */

  

  

  

  var ss:TextField.StyleSheet = new TextField.StyleSheet(); //注釋1

  ss.load("sample.css"); //注釋2

  content.styleSheet = ss; //注釋3

  content.multiline= true;

  content.wordWrap = true;

  content.html = true;

  

  

  

  story = new XML(); //注釋4

  story.ignoreWhite = true;

  story.load("sample.html"); //注釋5

  story.onLoad = function () { //注釋6

   content.htmlText = story;

  }

  注釋1:定義一個(gè)變量ss,它的類型為TextField.StyleSheet。

    注釋2:讀取sample.css文件的內(nèi)容到ss中。這里要注意所有文件的保存路徑要一致。

    注釋3:設(shè)置文本框content的幾個(gè)屬性。

    注釋4:創(chuàng)建一個(gè)xml對(duì)象。

    注釋5:讀入sample.html文件的內(nèi)容到story中。

    注釋6:設(shè)置story的onLoad函數(shù),函數(shù)的內(nèi)容為設(shè)置content的htmlText為story。

  三、實(shí)際用途

  從實(shí)例的制作過(guò)程中可以看到,以前在Flash中一行一行地調(diào)整文字顯示效果的時(shí)候再也不會(huì)出現(xiàn)。Flash MX 2004中操作HTML文件非常靈活,修改顯示效果也很方便,只要改一下相應(yīng)的文件內(nèi)容就可以了。這在用Flash來(lái)做比較多的文字顯示處理的場(chǎng)景中非常有用。

  

相關(guān)頻道: eNews

您對(duì)本文或本站有任何意見,請(qǐng)?jiān)谙路教峤?,謝謝!

投稿信箱:tougao@enet16.com