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);
  • 相关阅读:
    堆得简单介绍以及堆排序
    从交换两个变量的值来看程序员的“奇技淫巧”
    两道有意思的题目
    mac上使用brew
    安全考虑,binlog_row_image建议尽量使用FULL
    Python3.6新特性
    自动化测试基础篇--Selenium浏览器操作
    自动化测试基础篇--Selenium Xpath定位
    自动化测试基础篇--Selenium元素定位
    自动化测试基础篇--Selenium Python环境搭建
  • 原文地址:https://www.cnblogs.com/xcai/p/2647900.html
Copyright © 2011-2022 走看看