header
ask question
Click here to ask Question Now Its free No registration required. Flash, Flex, Flash Media Server, ActionScript,Adobe Air. Most questions receive a response in an hour.
Venkatesan
Points:0
Posts:0

2/9/2011 11:23:44 PM

Title: Difference between addChild and includeInLayout


Hi all..

I need to knw the difference between addChild(button) and includeInLayout=true.

scenario:

1)I have a button1 in mxml with include in layout as false.

in my creation complete method of the file, i do the following operation..

a) button1.includeInLayout=true;
b)this.addChild(button1);

What is the difference between a and b. though both works, which one is efficient?



1
Rex
Points: 1280
Posts:0
2/10/2011 3:08:59 AM



button1.includeInLayout=true; --> Its default value so you don't need to set it to true. It wont effect anything.

when you addChild an object in flash its added to flash object hierarchy. When a object is added its by default included in layout and flex has to make calculations to place it considering all other components.

If we set an object "includeInLayout = false" flex will ignore its size and can place this component below or above the other components. It wont be adjusted to fit with other components.

2
RedBull
Points: 930
Posts:0
2/10/2011 3:28:48 AM



when components are placed in a container like vBox they are placed adjacent to each other by measuring there dimensions by Flash Builder. If we set includeInLayout= false then that component is ignored and other components are allocated its space. It may overlap others or will be overlapped by others.

Usually this property is set to false for hidden components. Which are required to made visible later. So they are includInLayout later when there visibility is set to true. This is done sometimes to speedup the application initialize time and improve performance.


Post your Reply
Name  

Email

Type your Reply or Answer

Are you human? What is 8+8 



Members Login

Email  
Password
Forgot Password





This website focus on: Flash | Flex | FMS | RED5 | WOWZA | Flash Media Server | Adobe AIR | ActionScript,Flash Solutions | Flash Question | Flash Answers | Flash Developers | Flash Problem, Flash Help, Flash bugs, Flash workaround | Flash Blog | Flex Question Answers | Flash Forum | Flex Development | Actionscript development | Flash development | Adobe AIR development
Copyright © 2008 AskMeFlash.com. All rights reserved. Privacy Policy | Terms & Conditions