zoukankan      html  css  js  c++  java
  • flash IDE组件使用

    第一点:设置组件的字体

    在FLASH中我们可以使用setStyle来设置组件的样式..
    可对于像List/ComboBox/DataGrid这类数据显示类的组件...
    使用

    setStyle("textFormat",textFormat)


     

    并不会设置其中的数据区域的文本样式..
    那是因为这类组件..显示数据部份为CellRenderer..
    而对组件setStyle并不会影响到CellRenderer..
    我们应当调用setRendererStyle方法来另外对CellRenderer进行设置

    list.setRendererStyle("textFormat",new TextFormat("宋体",14,0xFF6600));

    另外..如果想像Flex那样达到全局样式设置的效果..
    可以使用StyleManager类..该类在fl.managers中..
    只要使用
     
    Lis组件,就得使用他继承SelectableList的setRendererStyle(name:String, style:Object, column:uint = 0):void方法

    myList.setRendererStyle(”textFormat”,myTextFormat); 

    而ComboBox组件是由 TextInput 和 List 组合而成的,那就需要分开设置

    myComboBox.textField.setStyle(”textFormat”,myTextFormat);//顶部显示字体样式
    myComboBox.dropdown.setRendererStyle(”textFormat”, myTextFormat);//下拉选相里的字体样式
     
    第二点:更改组件的外观

    拿ScrollPane举例,假如我们想更改这个组件的背景。打开帮助,找到介绍他样式的地方;通过说明一栏的介绍,知道负责背景的是upSkin的样式,知道了这个,我们可以动手写代码了:

    import fl.containers.ScrollPane;
    import flash.display.Shape;
    import flash.display.Graphics;

    var myBg:Shape=new Shape();
    myBg.graphics.beginFill(0×990000);
    myBg.graphics.drawRect(0,0,10,10);
    myBg.graphics.endFill();

    var myScrollPane:ScrollPane =new ScrollPane();
    myScrollPane.setStyle(”upSkin”,myBg);
    //myBg还可以是库里面导出的类(不需要实例化)
    addChild(myScrollPane);
  • 相关阅读:
    产生唯一的临时文件mkstemp()
    Linux文档时间戳查看和修改——stat
    Linux下快速查找文件
    Crypt加密函数简介(C语言)
    产生随机数 random
    见微知著——从《新闻联播》挖掘价值资讯擒拿年度政策受益牛股
    Linux中link,unlink,close,fclose详解
    不用输液
    javaScript document对象详解
    javascript初步了解
  • 原文地址:https://www.cnblogs.com/xcai/p/2647900.html
Copyright © 2011-2022 走看看