Skip to main content
Participant
February 10, 2007
Question

Issue with moduleLoader and width/height definitions.

  • February 10, 2007
  • 2 replies
  • 16417 views
We are currently evaluating Flex 2 and I have come across an issue with ModuleLoader

Here is my setup

In my main mxml I have this (Code Snippet):
<mx:HDividedBox width="100%" height="100%" styleName="DividedBox">
<mx:Accordion width="200" height="100%" left="0" top="0" styleName="Accordian" id="accManagement" selectedIndex="0">
<mx:Canvas label="Services" width="100%" height="100%" id="accServices" styleName="Accordian">
</mx:Canvas>
<mx:Canvas label="Directories" width="100%" height="100%" id="accDirectories">
</mx:Canvas>
</mx:Accordion>
<mx:ModuleLoader id="modServices" url="modules/Services.swf" width="100%" height="100%"/>
</mx:HDividedBox>

You can see I'm doing a ModuleLoader to services.swf.
The issue I am having is that the module loads fine, but the module itself isn't taking up 100% width and height, its shrunk down as far as can be. If I add a border around this moduleloader tag, I can see that it is correctly 100%. IF I add a border in the mx:module definition, I can see that is definately is not 100%.
Here is my mx:module code in services.mxml/swf

You can see I have this also 100%/100%. If I specify an actual pixel size that seems to work. The issue is, its not honoring 100% of the available space allocated to it from the moduleloader call. Any ideas?

<?xml version="1.0" encoding="utf-8"?>
<mx:Module xmlns:mx=" http://www.adobe.com/2006/mxml" width="100%" height="100%" borderStyle="solid" borderThickness="4">
<mx:Canvas backgroundColor="#cccccc" width="100%" height="100%">
<mx:TabNavigator selectedTabTextStyleName="TabSecondaryBlueSelectedText" id="tabServices" selectedIndex="0" styleName="TabSecondaryBlue" top="60" width="100%" height="100%">
<mx:Canvas label="Catalog" width="100%" height="100%" id="lblCatalog" styleName="TabContent">
</mx:Canvas>
<mx:Canvas label="Reporting" width="100%" height="100%" id="lblReporting" styleName="TabContent" borderStyle="none">
</mx:Canvas>
</mx:TabNavigator>
<mx:Text x="10" y="10" text="Services" fontFamily="Arial" fontSize="16" fontWeight="bold" color="#000000" id="lblServices"/>
<mx:Image x="10" y="36" source="images/icon_software_management_16.gif" id="imgServiceType"/>
<mx:Text x="32" y="34" text="Software" id="lblServiceType" enabled="true" fontFamily="Arial" fontWeight="bold" color="#000000" fontSize="10"/>
</mx:Canvas>
</mx:Module>
    This topic has been closed for replies.

    2 replies

    Participant
    February 12, 2007
    Yeah--you need to use percentWidth and percentHeight (not width and height) in your <mx:Module> component. Check this thread:

    http://tech.groups.yahoo.com/group/flexcoders/message/62208

    I lost several hours to this myself, and I have a feeling you and I are not the only ones.

    HTH,
    Chris
    Participant
    February 12, 2007
    Is that true for item renderes also? Ie.
    <mx:TileList id="list" dataProvider="{TileListdp}" itemRenderer="view.ServiceTypeThumb" borderStyle="none" width="100%" height="100%" direction="vertical" allowMultipleSelection="false" enabled="true" selectedIndex="0"/>

    The content of view.ServiceTypeThumb is this:
    You can see i'm using percentWidth=100 but that still isn't working. If I set a border to see the actual width, in the above code it is correclty 100%, but in this code it isn't.. Any ideas?

    <mx:HBox xmlns:mx=" http://www.adobe.com/2006/mxml"
    percentWidth="100"
    height="20"
    verticalAlign="middle" verticalGap="0" verticalScrollPolicy="off" horizontalScrollPolicy="off"
    xmlns="view.*"
    showInAutomationHierarchy="true"
    horizontalAlign="left" label="{data.name}">
    <mx:Image source="{data.icon}" width="16" height="16"/>
    <mx:Label text="{data.name}" color="#000000" fontWeight="bold" width="100%" textAlign="left"/>
    </mx:HBox>
    Participant
    February 12, 2007
    Sorry, but I got about as far as I needed to in my own case and then stopped. I did notice that I needed to monkey with the width/height vs. percentWidth/percentHeight in some of my <mx:Module>s subcomponents, but I didn't have to do it so much that I noticed a pattern.

    Anybody else?
    Participant
    February 11, 2007
    Any thoughts here? I played with it more but no luck:(