中国站长下载-为中国站长提供最好最全的建站资源! 首 页发布资源有事留言繁體中文
设为首页
加入收藏
联系我们
 
您当前的位置:中国站长下载 -> 文章中心 -> 网页制作 -> Flash -> 文章内容  虚拟主机 域名注册 退出登录 用户管理
栏目导航
· Dreamweaver · Fireworks
· Flash · 网页特效
· HTML/CSS · 网页配色
热门文章
· sndvol32 - sndvol3...
· [组图] FLASH:《大话李白》...
· 个人网站到底能赚多...
· [图文] Rundll.exe是病毒吗...
· [组图] Flash:制作MV
· 价值12万元的网站SE...
· 网站创业者,你需要...
· 一个成功的网站设计...
· [图文] FLASH:韩国导航条解...
· 中国网站的赚钱模式...
相关文章
· [图文] 快速获取Flash课件中...
· [组图] FLASH:《大话李白》...
· [图文] FLASH:韩国导航条解...
· [组图] Flash:制作MV
· Flash MX制作堆雪效...
· FlashMX课件中的拖动...
· [图文] 教你一招绝的!把Fl...
· 使用Flash MX的3个小...
· Flash课件一网打尽
· [图文] Flash Player 7 安全...
Flash MX 2004新特性实例学习五
作者:佚名  来源:不详  发布时间:2006-8-14 14:31:55  发布人:chinazhan

 减小字体 增大字体

    实例六、Text Enhancements

  一、涉及特性

  在实例中,主要涉及在Flash 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;

  }

      注释1:定义一个变量ss,它的类型为TextField.StyleSheet。

    注释2:读取sample.css文件的内容到ss中。这里要注意所有文件的保存路径要一致。

    注释3:设置文本框content的几个属性。

    注释4:创建一个xml对象。

    注释5:读入sample.html文件的内容到story中。

    注释6:设置story的onLoad函数,函数的内容为设置content的htmlText为story。

  三、实际用途

  从实例的制作过程中可以看到,以前在Flash中一行一行地调整文字显示效果的时候再也不会出现。Flash MX 2004中操作HTML文件非常灵活,修改显示效果也很方便,只要改一下相应的文件内容就可以了。这在用Flash来做比较多的文字显示处理的场景中非常有用。

 
[] [返回上一页] [打 印] [收 藏]
∷相关文章评论∷    (评论内容只代表网友观点,与本站立场无关!) [更多评论...]
中国站长下载
中国站长下载

本页只接受PR>=4 IT类站点连接,申请连接,谢谢您们的支持!希望我们的下载站能够真正帮到中国的站长们!
关于本站 - 网站帮助 - 广告合作 - 下载声明 - 友情连接 - 网站地图
Copyright © 2005-2006 ChinaZhan.Net. All Rights Reserved .