如何获得Flex组件,以填补使用ActionScript可用空间 [英] How to get Flex components to fill available space using Actionscript

查看:178
本文介绍了如何获得Flex组件,以填补使用ActionScript可用空间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在铺设使用MXML我的Flex组件,让他们正常工作。但后来我想了它们转换为ActionScript,因为我希望他们来扩展基础组件,它提供的默认功能。

我已经去了code工作只是我的组件,用于通过WIDTH =100%和高度=100%,填补了整个空间似乎只使用默认的大小显示。你知不知道我怎样才能让他们占据了整个空间了吗?

下面是一个测试组件,我玩表现出的问题。

Main.mxml

< XML版本=1.0编码=UTF-8>

< MX:组件*应用程序的xmlns:MX =htt​​p://www.adobe.com/2006/mxml的xmlns烧烤=     backgroundGradientColors =[#000000,#3333dd]     =了minWidth480=了minHeight320     布局=垂直verticalAlign =顶horizo​​ntalAlign =中心     以下属性来=0paddingRight =0paddingTop =30paddingBottom会=0     WIDTH =100%高度=100%>

 < MX:垂直框的backgroundColor =0xcccc66>
    &所述;的mx:ViewStack的ID =mainViewStack宽度=100%高度=100%颜色=0x323232>
        <烧烤:testcomp隔离ID =testcomp隔离高度=100%WIDTH =100%/>
        <烧烤:ResultsBox />
    < / MX:ViewStack的>
< / MX:垂直框>
 

TestComp.as

封装组件{

进口mx.containers.VBox;

进口mx.containers.Panel;

进口flash.events。*;

 公共类testcomp隔离扩展垂直框{
    私人VAR号码:面板;

    功能testcomp隔离(){
        超();
        percentHeight = 100;
        percentWidth = 100;
    }

    覆盖保护功能createChildren():无效{
        super.createChildren();
        P =新的面板();
        p.percentHeight = 100;
        p.percentWidth = 100;
        p.title =测试比较;
        的addChild(对​​);
    }
}
 

}

解决方案

  resizeToContent =真
 

I was laying out my Flex components using mxml and had them working correctly. But then I wanted to switch them over to Actionscript because I wanted them to extend a base component that provides default functionality.

I've go the code working except that my components that used to fill the entire space using width="100%" and height="100%" appear to display just using the default sizes. Do you know How I can get them to take up the entire space again?

Here is a test component I am playing with that exhibits the problem.

Main.mxml

<?xml version="1.0" encoding="utf-8"?>

<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" xmlns:bbq="components.*" backgroundGradientColors="[#000000, #3333dd]" minWidth="480" minHeight="320" layout="vertical" verticalAlign="top" horizontalAlign="center" paddingLeft="0" paddingRight="0" paddingTop="30" paddingBottom="0" width="100%" height="100%" >

<mx:VBox backgroundColor="0xcccc66">
    <mx:ViewStack id="mainViewStack" width="100%" height="100%" color="0x323232">
        <bbq:TestComp id="testComp" height="100%" width="100%" />
        <bbq:ResultsBox />
    </mx:ViewStack>
</mx:VBox>    

TestComp.as

package components {

import mx.containers.VBox;

import mx.containers.Panel;

import flash.events.*;

public class TestComp extends VBox {
    private var p:Panel;

    function TestComp(){
        super();
        percentHeight = 100;
        percentWidth = 100;
    }

    override protected function createChildren():void {
        super.createChildren();
        p = new Panel();
        p.percentHeight = 100;
        p.percentWidth = 100;
        p.title = "Test Comp";
        addChild(p);
    }       
}

}

解决方案

resizeToContent=true

这篇关于如何获得Flex组件,以填补使用ActionScript可用空间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆