Reputation: 4430
I have several MXML layouts that are used for my application's menu on the Playbook, I need to be able to create a different layout for each orientation because my side-bar menu wouldn't work when in portrait, what is the best way to create a view or two that can be used in each orientation but share the important functional code.
I tried first to make MXML views and separate the script and into a file and including it with the script tag but this doesn't work well for various reason.
An alternative more suited to the proper use of the flex tools and capabilities would be appreciated.
Thanks
Upvotes: 3
Views: 887
Reputation: 1788
For that you use States in one MXML, for example:
<s:View>
<s:states>
<s:State name="portrait"/>
<s:State name="landscape"/>
</s:states>
<s:layout.portrait>
<s:HorizontalLayout/>
</s:layout.portrait>
<s:layout.portrait>
<s:VerticalLayout/>
</s:layout.portrait>
<s:Label includeIn="portrait"/>
[...]
</s:View>
Upvotes: 1