Flash MX 2004新特性实例学习五
时间:2009-6-2 11:44:36 作者: 来源:
 

    实例六、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来做比较多的文字显示处理的场景中非常有用。

上一篇:
下一篇:
 
网页模板 网站模板 网站建设 网页设计 网页设计师兼职 自助建站 ...
网站魔坊,网页模板,网站模板,免费网页模板,在线模板设计,免费建站,门户网站搭建,建站,企业网站,奇思网络,奇思,智能建站,自助建站,拖动建站,网站建设,网页设计,在线设计模板
www.wzmof.com/ 47K 2009-5-21
 
商巢...
商巢是一个真实的商业交友社区、为用户提供交友、贸易、社区、建站等服务;临渊慕鱼,不如退而结网!商巢结网行动
www.ncooo.com/ 47K 2009-5-21
 
商巢创业 门户创业 商人网络家园 魔坊建站 商业交友
商巢下的门户,门户又一独立实体与商巢合作,由商巢负责技术的更新以及硬件的支持,门户负责自己领域的市场推广以及相应的售后服务即可。 打破以往门户需要源源不断的技术、硬件投入模式,盈利模式清晰 行业门户以及门户下企业网站由网站魔坊...
mhcy.ncooo.com/ 36K 2009-5-14
 
奇思网络技术 网站建设 深圳网站建设
中小外贸企业做电子商务,需要从两点技术突围 08-01 企业网站建设 提供网站策划、网站建设、数据库开发至网络营销全套解决方案。能针对客户所处行业,结合营销特征量身订做高质量网站建设方案。 网站推广 怎样使网站的投资得到回报?这需要经验...
www.qsnet.com.cn/ 48K 2009-4-2
 
深圳艺术网
深圳艺术网,中国艺术网,中国当代艺术网,广东当代艺术网,广东艺术网,南方当代艺术网,深圳美术网,深港美术网,深港艺术网,深港当代艺术网,杜应红,深圳当代艺术创作库,深圳创库,深圳美术,深圳艺术,深圳收藏,深圳艺术收藏,深圳音乐网,深圳舞蹈...
www.szarts.cn/ 119K 2009-6-9
 
网页设计也通过人脉赚钱-技术传播
 
网页设计114 -打造中国网页设计、网站建设技术信息学习、交流、互动平台
                         打造网页设计师兼职创业平台中心