14 Replies Latest reply on Nov 30, 2009 6:12 AM by David_F57

    module that doesn't scale 100% to its container

    nikos101 Level 2

      Hi,

       

      I have a module that doesn't scale 100% to its container


      <?xml version="1.0" encoding="utf-8"?>
      <mx:Module xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical"
          percentWidth="100" percentHeight="100" verticalGap="0"
          >

       

          <mx:creationComplete>
              <![CDATA[
                 
              vo = VO.getInstance();
              ]]>
          </mx:creationComplete>

       

          <mx:Script>

       

      You see anything wrong?

        • 1. Re: module that doesn't scale 100% to its container
          David_F57 Level 5

          Hi,

           

          first up I would try width="100%" height="100%" and layout="absolute", then make sure your container has no padding set.

           

          David.

          • 2. Re: module that doesn't scale 100% to its container
            David_F57 Level 5

            Hi,

             

            One more thing if you are instantiating as per our earlier discussion you could set the width and height property there

             

            lm.height=container.height;

            lm.width=container.width;

             

            David.

            • 3. Re: module that doesn't scale 100% to its container
              nikos101 Level 2

              Thanks but no such luck

               

              I've got the following structure

               

              Superpanel  (resizable component that extends  panel)

                   module width ="100%" height = 100%

                        Hbox width ="100%"

                        datagrid width ="100%" height = 100%

               

               

               

              the Hbox and   datagrid  are tiny little things that should grow with the

              Superpanel

              • 4. Re: module that doesn't scale 100% to its container
                David_F57 Level 5

                So what is the module going into the panel ?

                 

                how about setting top/left/bottom/right to 0;

                • 5. Re: module that doesn't scale 100% to its container
                  nikos101 Level 2

                  I set up the panel like this      

                   

                  privileges= new SuperPanel();
                          privileges.x=0;
                          privileges.y=0;
                          privileges.width=725;
                          privileges.height=500;
                          privileges.verticalScrollPolicy='off';
                          privileges.allowDrag=true;
                          privileges.allowResize=true;
                          privileges.allowClose=true;
                          privileges.allowMaximize=true;
                          privileges.allowMinimize=true;
                          privileges.allowMaximize=true;
                          privileges.addEventListener(CloseEvent.CLOSE,privilegesClose)
                          privileges.layout='vertical';
                          privileges.title="Assign privileges";
                          privileges.addChild(privilegesML);

                   

                   

                  then I load the module

                   

                            privilegesML.url = 'modules/Privileges.swf';

                   

                   

                  The module looks a bit like this

                   

                  <?xml version="1.0" encoding="utf-8"?>
                  <mx:Module xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" paddingBottom="0" paddingLeft="0" paddingRight="0" paddingTop="0"
                      width="100%" height="100%" verticalGap="0"
                      >

                      <mx:creationComplete>
                          <![CDATA[
                             
                          vo = VO.getInstance();
                          ]]>
                      </mx:creationComplete>


                      <mx:HBox width="100%">
                          <mx:Button label="Save changes to server" click="deals.dataProvider=tradesResult">
                              <mx:icon>@Embed(source='../../images/32px-Crystal_Clear_app_kwrite.png')</mx:icon>

                          </mx:Button>
                          <mx:Button label="Refresh list" icon="@Embed(source='../../images/cog.png')" click="myService.getUsers();"/>
                      </mx:HBox>

                      <mx:AdvancedDataGrid id="deals" displayItemsExpanded="false" dataProvider="{vo.usersResult}" width="100%" height="100%" sortExpertMode="true" variableRowHeight="true" headerStyleName="smallHeader" editable="false" fontWeight="normal">



                          <mx:columns>
                              <mx:AdvancedDataGridColumn dataField="name" headerText="User name" width="120" textAlign="center" editable="false"/>
                             
                              <mx:AdvancedDataGridColumn headerText="Add trade" width="70" editorDataField="addTradeView" rendererIsEditor="true" backgroundColor="0xddf5ff">
                                  <mx:itemRenderer>
                                      <mx:Component>
                                         


                                              <mx:CheckBox >
                      <mx:Script>
                                                  <![CDATA[
                                                      override public function set data(value:Object):void
                                                      {
                                                          super.data=value;
                                                          if(value != null){
                                                          this.selected=this.data.addTradeView;
                                                          }
                                                      }
                                                  ]]>
                                              </mx:Script>

                                                  <mx:change>
                                                      <![CDATA[
                                                      this.data.isModifiedClientSide = 1;
                                                      this.data.addTradeView = this.selected; //used to check through data and update server
                                                      ]]>
                                                  </mx:change>
                                              </mx:CheckBox>
                                     
                                      </mx:Component>
                                  </mx:itemRenderer>

                              </mx:AdvancedDataGridColumn>

                        


                          </mx:columns>

                      </mx:AdvancedDataGrid>





                     
                  </mx:Module>

                  • 6. Re: module that doesn't scale 100% to its container
                    nikos101 Level 2

                    I think I'll need to just make to with absolute widths I guess, so sad

                     

                    best wishes

                     

                    Nikos Katsikanis (Msci)

                    Web Developer

                    • 7. Re: module that doesn't scale 100% to its container
                      David_F57 Level 5

                      Ok,

                       

                      so the module fills the super panel completely, you can keep you layout for the module to suit how it is populated but for the panel I think the layout should not be vertical as when you resize it the module won't resize correctly

                       

                      so

                      1- load the module, privelegesML.url=myModule;

                      2-set module parameters,  privelegesML.top=privelegesML.bottom=privelegesML.left=privelegesML.right=0;

                      3-add PrivelegesML to the panel;

                       

                      i'm sorta guessing here as i'm rebuilding my dev pc so no flashbuilder for a few hours.

                       

                      David

                      1 person found this helpful
                      • 8. Re: module that doesn't scale 100% to its container
                        nikos101 Level 2

                        Something really weird happens when using this module stuff

                         

                        if I do

                         

                        dealsCanvas.getChildByName('privileges');

                         

                        I get a null object, I am convinced that this should not be the case as in

                        the variables privileges.parent.id = dealsCanvas

                         

                        best wishes

                         

                        Nikos

                        • 9. Re: module that doesn't scale 100% to its container
                          nikos101 Level 2

                           

                           

                          Multiple markers at this line: -1119: Access of possibly undefined property right through a
                          reference with static type modules:CustomModuleLoader. -1119: Access of possibly undefined
                          property bottom through a reference with static type modules:CustomModuleLoader. -1119:
                          Access of possibly undefined property top through a reference with static type
                          modules:CustomModuleLoader. -1119: Access of possibly undefined property left through a
                          reference with static type modules:CustomModuleLoader.
                          • 10. Re: module that doesn't scale 100% to its container
                            David_F57 Level 5

                            Hi,

                             

                            I've just finished reinstalling FB so give it about 30 minutes I'll see what I can come up with.

                             

                            David

                            1 person found this helpful
                            • 11. Re: module that doesn't scale 100% to its container
                              David_F57 Level 5

                              Hi,

                               

                              http://gumbo.flashhub.net/modsizer/ (view source enabled)

                               

                              Its a slap together and the resizing isn't perfect but is this what you are trying to achieve ?

                               

                              David

                              • 12. Re: module that doesn't scale 100% to its container
                                nikos101 Level 2

                                Yours work the way I want thanks, but my Flex 3 one still has the problems. Thanks anyway and nice use of the FB4

                                • 13. Re: module that doesn't scale 100% to its container
                                  nikos101 Level 2

                                  That custom panel you wrote is cool, I wonder how easy it would be to not allow draging when you try resize the columns in the DG, or interact with any of the child components?

                                  • 14. Re: module that doesn't scale 100% to its container
                                    David_F57 Level 5

                                    Hi,

                                     

                                    if its done as a skin things work better(heres some code for you to play with)

                                     

                                    http://gumbo.flashhub.net/sizer/

                                     

                                    this was my original effort, look at the skin code (i don't think this thing had move enabled) i can't find the code but I did a skin and it only moved with the mousedown on the caption.

                                     

                                    David