Note that there are some explanatory texts on larger screens.

plurals
  1. POSimulate includeInLayout=false in pure Actionscript code
    primarykey
    data
    text
    <p>If you know Flex, you probably know what the property "includeInLayout" does. If not, this property make the parent of your component disregard the bounds (like width and height) of your component in render their own bounds.</p> <p>Description in reference below:</p> <blockquote> <p>Specifies whether this component is included in the layout of the parent container. If true, the object is included in its parent container's layout and is sized and positioned by its parent container as per its layout rules. If false, the object size and position are not affected by its parent container's layout.</p> <p><a href="http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/mx/core/UIComponent.html#includeInLayout" rel="nofollow">http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/mx/core/UIComponent.html#includeInLayout</a></p> </blockquote> <p>In Flex, for example:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="application1_creationCompleteHandler(event)"&gt; &lt;mx:Script&gt; &lt;![CDATA[ import mx.events.FlexEvent; protected function application1_creationCompleteHandler( event:FlexEvent ):void { trace( container.width, container.height ); // output: 200 200 } ]]&gt; &lt;/mx:Script&gt; &lt;mx:Canvas id="container"&gt; &lt;mx:Button label="Test" width="100" height="100" /&gt; &lt;mx:Button label="Test2" width="200" height="200" /&gt; &lt;/mx:Canvas&gt; &lt;/mx:Application&gt; </code></pre> <p>Now if I set includeInLayout="false" in second button:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="application1_creationCompleteHandler(event)"&gt; &lt;mx:Script&gt; &lt;![CDATA[ import mx.events.FlexEvent; protected function application1_creationCompleteHandler( event:FlexEvent ):void { trace( container.width, container.height ); // output: 100 100 } ]]&gt; &lt;/mx:Script&gt; &lt;mx:Canvas id="container"&gt; &lt;mx:Button label="Test" width="100" height="100" /&gt; &lt;mx:Button label="Test2" width="200" height="200" includeInLayout="false" /&gt; &lt;/mx:Canvas&gt; &lt;/mx:Application&gt; </code></pre> <p>I know of all framework architecture involved to implement this property and know than this property is a property from Flex Framework. What I wanna is this behavior in pure actionscript. For example:</p> <pre><code>import flash.display.Shape; var myBox:Shape = new Shape(); myBox.graphics.beginFill(0xFF0000); myBox.graphics.drawRect(0, 0, 100, 100); myBox.graphics.endFill(); addChild(myBox); trace(width, height); // output: 100 100 var myAnotherBox:Shape = new Shape(); myAnotherBox.graphics.beginFill(0xFF00FF, .5); myAnotherBox.graphics.drawRect(0, 0, 200, 200); myAnotherBox.graphics.endFill(); addChild(myAnotherBox); trace(width, height); // output: 200 200 </code></pre> <p>Is there some equivalent implementation in pure Actionscript to reproduce this behavior on "myAnotherBox"?</p> <p>I already tried:</p> <ul> <li>Change transform matrix;</li> <li>Change transform pixelBounds;</li> <li>Change scrollRect;</li> <li>Apply masks;</li> </ul> <p>And no successful.</p> <p>Cheers...</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload