zoukankan      html  css  js  c++  java
  • Flex读文本文件

    布局:

    1 <s:Group id="maskGroup" width="503" height="332" x="657" y="165">
    2         <s:Rect width="100%" height="100%">
    3             <s:fill>
    4                 <s:SolidColor color="#000000"/>
    5             </s:fill>
    6         </s:Rect>
    7     </s:Group>
     1 <mx:Canvas x="626" y="151" width="565" height="360" backgroundColor="#5976A4"
     2                horizontalScrollPolicy="off" verticalScrollPolicy="off">
     3         <s:Scroller id="scrollerId" width="100%" height="100%"
     4                     horizontalScrollPolicy="off" interactionMode="touch"
     5                     skinClass="skin.libraryIntroduce.ScrollerSkin">
     6             <s:Group x="0" y="0" width="565" height="360">
     7                 <s:Label id="introTxt" x="31" y="14" width="503" color="#FFFFFF" fontFamily="微软雅黑"
     8                          fontSize="20" textAlign="left" verticalAlign="top"
     9                          mask="{maskGroup}"/>
    10             </s:Group>
    11         </s:Scroller>
    12     </mx:Canvas>

    AS:

    var file:File=new File("文本文件的绝对路径");
    if(file2.exists)
                        {
                            var fileStream:FileStream=new FileStream();
                            fileStream.open(file,FileMode.READ);
        //算高度仅供参考                    
    introTxt.height=(Math.floor(Number(fileStream.bytesAvailable/45))+5)*30;
                            introTxt.text=fileStream.readMultiByte(fileStream.bytesAvailable,"gbk");
                            trace(introTxt.height);
                            scrollerId.verticalScrollBar.value=0;
                        }
  • 相关阅读:
    知识点拾遗——装饰器
    知识点拾遗——函数部分
    re模块和分组
    re模块进阶
    面向对象总结
    模块总结整理
    项目目录结构
    日志(模块logging)
    位、字节、字符 概念
    socketserver实现并发通讯
  • 原文地址:https://www.cnblogs.com/dongyl/p/4021711.html
Copyright © 2011-2022 走看看