Make Www.Edu-cn.Com Your Home Page!
用户名: 密码: 验证码: 注册
  当前位置: > 中国教程网>图形图像>平面设计>Flash> Flash MX 2004新特性实例学习五

Flash MX 2004新特性实例学习五

作者:硅谷动力   来源:中国教程网   点击:   日期:2007-03-31

    实例六、Text Enhancements

漂亮MM女性网

  一、涉及特性 中国教程网

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

edu4u.com.cn

  二、制作过程

中国教程网

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

中国论文网

  headline { 中国教育网

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

edu-cn.com

   font-size: 16px; 中国教育网

   font-weight: bold;

edu-cn.com

   display: block;

www.edu-cn.com

  }

edu-cn.com

  subheadline {

edu4u.com.cn

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

中国教程网

   font-size: 13px; www.edu-cn.com

   font-weight: bold; AOE3 STUDIO

   display: block;

中国教育网

  }

www.edu4u.com.cn

  mainBody {

edu4u.com.cn

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

中国教程网

   font-size: 10px; edu4u.com.cn

   display: block;

AOE3 STUDIO

  } www.edu4u.com.cn

  biline { 中国论文网

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

edu-cn.com

   font-size: 11px; 中国论文网

   font-style: italic;

漂亮MM女性网

   display: inline;

edu4u.com.cn

  }

中国教程网

  A { 漂亮MM女性网

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

中国论文网

   color:cccccc;

中国教程网

   font-size: 10px;

中国教育网

   display: inline;

www.edu-cn.com

   text-decoration:underline; 漂亮MM女性网

  }

漂亮MM女性网

  上面的css文件中,中括号里面的是对应的属性。比如font-family是字符集,font-size是字体大小,display是字体的显示方式,等等。只要有简单的网页制作知识就应该可以看懂的。 www.edu-cn.com

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

漂亮MM女性网

   Giant Sea Lion Spotted

漂亮MM女性网

   Citizens scared, amazed   

AOE3 STUDIO

  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. 漂亮MM女性网

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

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

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

edu4u.com.cn

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

edu4u.com.cn

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

中国教育网

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

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

  The following is Sample Code and is subject to all restrictions www.edu4u.com.cn

  on such code as contained in the End User License Agreement

www.edu-cn.com

  accompanying this product.

中国论文网

  */    edu-cn.com

  var ss:TextField.StyleSheet = new TextField.StyleSheet(); //注释1 AOE3 STUDIO

  ss.load("sample.css"); //注释2 www.edu4u.com.cn

  content.styleSheet = ss; //注释3 www.edu4u.com.cn

  content.multiline= true; edu-cn.com

  content.wordWrap = true; 中国论文网

  content.html = true;   

edu-cn.com

  story = new XML(); //注释4 漂亮MM女性网

  story.ignoreWhite = true;

edu-cn.com

  story.load("sample.html"); //注释5 www.edu4u.com.cn

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

www.edu-cn.com

   content.htmlText = story;

AOE3 STUDIO

  } www.edu4u.com.cn

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

中国教程网

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

edu4u.com.cn

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

AOE3 STUDIO

    注释4:创建一个xml对象。 www.edu-cn.com

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

AOE3 STUDIO

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

AOE3 STUDIO

  三、实际用途

edu-cn.com

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


           

中国教程网



文章评论】 【收藏本文】 【推荐好友】 【打印本文】 【论坛讨论

   最新文章:
·用FLASH制作放大镜效果全过程(04-02)
·Flash:制作MV(03-31)
·Flash制作碧海蓝天海鸥飞片头动画(04-02)
·【视频教程】吕聪贤FLASH MX2004入门(04-02)
·教你用Flash画卡通人物的脸形(04-02)
·flash打造动画特效(03-31)
·飞舞的螺炫(04-02)
·Flash实例教程——鱼戏莲叶间(03-31)
·Flash初学者入门常见问题大总结(04-02)
·AS代码2.0:针对Flash Player 7(04-02)
   相关文章:
·Flash MX 2004新特性实例学习四 ·减少Flash MX 2004的启动时间
·Flash MX 2004新特性实例学习三 ·Flash背景设定技巧两则
·Flash MX 2004新特性实例学习二 ·用Flash建站的通用思路及步骤
·Flash MX 2004新特性实例学习一 ·用Flash MX软件制作遥控小汽车
·AS代码2.0:新的语言元素 ·flash打造动画特效

   文章评论:(0条)
  
用户名: 新注册) 密码: 匿名评论
评论内容:(不能超过250字,需审核后才会公布,请自觉遵守互联网相关政策法规。

 §最新评论:

  责任编辑:中国教程网  

© 2007 Copyright 中国教育网
DesignBy:AOE3 STUDIO & ROCOCO