Skip to main content
Participant
June 2, 2009
Question

Should itemCreationPolicy be inherited by default?

  • June 2, 2009
  • 2 replies
  • 2714 views

Hello, I'm new to the forum and I have been toying around with Gumbo for a while now. I tend to use states a lot and did notice that setting itemCreationPolicy to immedate is the new way to go if you want to have your controls initiated in order to work with them in actionscript before a specific state is entered. Nesting buttons and textinput controls inside containers like Box or Panel and setting includeIn or excludeFrom on those containers works like a charm, but if I want to have a specific control inside a container instantiated immedately I have to set includeIn and itemCreationPolicy on every child of the container that appears before the control I want to have access to in actionscript.

Example:

<mx:VBox horizontalAlign="center" width="100%" height="100%" id="receiverSearchBox" includeIn="FindReceiver,FindReceiverLoading,FindReceiverEx" itemCreationPolicy="immediate">

<mx:Text text="{resourceManager.getString('evoChat2008','message_receiver_long')}" styleName="standardLabel" includeIn="FindReceiver,FindReceiverLoading,FindReceiverEx" itemCreationPolicy="immediate" />

<mx:TextInput id="txtReceiver" styleName="inputBox" enter="receiverSearchClick(null);" includeIn="FindReceiver,FindReceiverLoading,FindReceiverEx" itemCreationPolicy="immediate" />

</mx:VBox>

If itemCreationPolicy was inherited to the childs of a container it would require a lot less redundant mxml code. Besides that I think the new states syntax is pretty clean and elegant.

This topic has been closed for replies.

2 replies

BulbheadAuthor
Participant
June 2, 2009

Ok, thanks for your response, will try to file a bug.

Using a spark VGroup instead of a halo VBox is indeed an easy workaround for now.

Also nesting halo components inside spark VGroups seems to work without problems.

Adobe Employee
June 23, 2009

Thanks for filing..the bug is now fixed in the open source trunk, revision 8062 (and later).

Regards,

Corey Lucier

Adobe Employee
June 2, 2009

Hmmm...

Well, the intent of itemCreationPolicy and itemDestructionPolicy is that they be paired up with includeIn or excludeFrom.  The creation policy is simply a hint to the underlying factory used to create the state-specific instance, that it needs to create the managed instance as early as possible.

In your example the VBox and its children are all included in the same states, so there is no need to specify includeIn or itemCreationPolicy on each child...  were you thinking of a different use case?

e.g. This works fine - foo, bar, and baz are all accessible prior to entering state 'b'.

<s:VGroup id="foo" includeIn="b" itemCreationPolicy="immediate">
   <s:Button id="foo"/>
   <s:Button id="baz"/>
</s:VGroup>

Adobe Employee
June 2, 2009

So I just tried a test using VBox instead of VGroup and you are correct, the full hierarchy is not being realized when it should due to the existing halo container creation policy.

Can you please file a bug and we'll address?

https://bugs.adobe.com/flex/

Regards,

Corey Lucier