文章导航PC6首页软件下载单机游戏安卓资源苹果资源

pc软件新闻网络操作系统办公工具编程服务器软件评测

安卓新闻资讯应用教程刷机教程安卓游戏攻略tv资讯深度阅读综合安卓评测

苹果ios资讯苹果手机越狱备份教程美化教程ios软件教程mac教程

单机游戏角色扮演即时战略动作射击棋牌游戏体育竞技模拟经营其它游戏游戏工具

网游cf活动dnf活动lol周免英雄lol礼包

手游最新动态手游评测手游活动新游预告手游问答

您的位置:首页网页设计Flash → Flash MX 2004新特性实例学习六

Flash MX 2004新特性实例学习六

时间:2004/11/7 2:21:00来源:本站整理作者:蓝点我要评论(0)


            
             
              
             
            

               
               

            



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



<评论文章列表><数量>0



相关阅读 Windows错误代码大全 Windows错误代码查询激活windows有什么用Mac QQ和Windows QQ聊天记录怎么合并 Mac QQ和Windows QQ聊天记录Windows 10自动更新怎么关闭 如何关闭Windows 10自动更新windows 10 rs4快速预览版17017下载错误问题Win10秋季创意者更新16291更新了什么 win10 16291更新内容windows10秋季创意者更新时间 windows10秋季创意者更新内容kb3150513补丁更新了什么 Windows 10补丁kb3150513是什么

文章评论
发表评论

热门文章 没有查询到任何记录。

最新文章 Flash CS4基础入门 如何在Flash中打开一个定制的浏览器新窗口?学习ActionScript 3.0的6个好处几个小技巧精简Flash文件体积在Flash动画中添加“加为收藏”和“设为首页

人气排行 Flash游戏制作--小熊拼图用Flash实现几种镜头效果Flash制作动画知识:遮罩Flash如何做鼠标指针样式Flash制作环形文字Flash制作声情并茂的电子相册实例讲解flashMTV制作全过程(3)鼠标效果系列教程:游动的鱼