当前位置: 首页 > 图文教程 > Flash动画 > Flash动画制作 > Flash MX 2004新特性实例(6)

Flash动画制作
Flash绘制简单的楼梯动画场景
关于影片剪辑在主场景中位置修改的Flash技巧
Flash教程:单选题的制作
Flash绘画技巧实例:鼠绘好看的水仙花
Flash人物走动动画的制作技巧分析
Flash钢笔工具绘图技巧详细分析
Flash辅助线轻松辅助工具绘制女孩脸部
Flash新手鼠绘教程(2):熟悉鼠绘工具
Flash新手鼠绘教程(1):怎样学习鼠绘
Flash新手鼠绘(3):漂亮的卡通花草场景
FLASH CTRL+C SHORTCUT IN IE 快捷键在IE中失效
Flash 绘画技巧 投影滤镜设置阴影
Flash 视频广告的定位兼容性问题
SWFText轻松制作Flash贺卡
人物走动Flash动画的制作技巧分析
Flash钢笔工具绘图的技巧详细讲解
Flash新手鼠绘(9):好看的月季花
Flash新手鼠绘(10):美丽逼真的郁金香
Flash新手鼠绘(11):逼真的瓢虫
FLASH8.0鼠绘实例(1):时尚气质美女

Flash动画制作 中的 Flash MX 2004新特性实例(6)


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-11-22   浏览: 58 ::
收藏到网摘: n/a

实例六、Text Enhancements

  一、涉及特性

  在实例中,主要涉及在 MX 2004中引用和显示外部的css文件和html文件。这些都是在Flash MX 2004中才有的新特性,应用也非常方便。本实例在Flash MX 2004中的操作非常简单,不过这正从侧面反映了它的功能强大。

  二、制作过程

  1、建立一个文件,命名为sample.css。其内容如下:   

  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文件中,中括号里面的是对应的属性。比如font-family是字符集,font-size是字体大小,display是字体的显示方式,等等。只要有简单的网页制作知识就应该可以看懂的。

  2、新建一个文件,命名为sample.html,其内容如下:   

   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.   

  这个文件的内容是应用了前面所创建的css格式的html文件。(严格来说,此文件更像是一个xml文件。)

    3、将一个名为sample.jpg的图片放到跟第一、二步所创建的文件的同一目录中。

  4、新建一个Flash MX 2004的文件,保存在跟前面所创建的文件所在的目录中。

  5、用文本工具在场景中拉一个文本输入框,命名为content。在属性面板上设置如1所示。

  6、在TimeLine中新建一个图层,命名为Action,在此层的Action面板上面增加如下语句:  

  /* 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;