mjesteve commented on issue #1132:
URL: https://github.com/apache/royale-asjs/issues/1132#issuecomment-888685178


   I got it!!! : )
   In the end, before getting back to debugging I thought I'd read about the 
resize event and I found the ResizeObserver API. 
   The best thing is that when I started to test I found 
"org.apache.royale.utils.observeElementSize" Et voilĂ  !!!! the magic was done...
   
   My goal is to create a bead that controls the size of the container, from 
any of its children, so I have a bit of work to do. For now I'll share my 
little example:
   
   `<?xml version="1.0" encoding="utf-8"?>
   <j:ResponsiveView xmlns:fx="http://ns.adobe.com/mxml/2009";
       xmlns:j="library://ns.apache.org/royale/jewel"
       xmlns:js="library://ns.apache.org/royale/basic"
       xmlns:jc="library://ns.apache.org/royale/community"
       initComplete="onInitComplete()">
   
       <fx:Script>
           <![CDATA[
           import org.apache.royale.utils.observeElementSize;
   
           public function onInitComplete():void
           {
               observeElementSize(cellcontainer.element,onSizeChange);
           }
   
           private function onSizeChange():void
           {
               trace(cellcontainer.element.offsetWidth, 
cellcontainer.element.offsetHeight);
           }
           ]]>
       </fx:Script>
   
       <j:ApplicationMainContent localId="main" hasTopAppBar="true" 
hasFooterBar="true" className="mainbg1">
           <j:SectionContent>
               <j:beads>
                   <js:Paddings padding="50"/>
               </j:beads>
                       
               <j:Grid gap="true">                    
                   <j:GridCell desktopNumerator="1" desktopDenominator="2" 
tabletNumerator="1" tabletDenominator="1" phoneNumerator="1" 
phoneDenominator="2">
                       <j:Group id="cellcontainer" localId="box1" 
style="background-color: #333333;" percentWidth="100" height="200" />
                   </j:GridCell>                    
                   <j:GridCell desktopNumerator="1" desktopDenominator="2" 
tabletNumerator="1" tabletDenominator="1" phoneNumerator="1" 
phoneDenominator="2"/>
               </j:Grid>
   
           </j:SectionContent>
       </j:ApplicationMainContent>
   
   </j:ResponsiveView>`
   
   Thx. ;)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to