3

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

Hamid
  • 4,410
  • 10
  • 43
  • 72
  • A colleague of me has managed to use Flex states to add different layouts for Playbook orientations. But I'd just create 2 different Views and #include the same.as file. – Alexander Farber Aug 18 '11 at 11:24

1 Answers1

1

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>
dst
  • 1,770
  • 13
  • 26
  • This is useful to an extent, but it doesn't help me work with the QNX components that I can't work with in MXML and have to be written in AS code. – Hamid Aug 19 '11 at 09:27
  • There is a MXML wrapper around those QNX components but it breaks the ui since SDK got updated to 1.1 :( – dst Aug 19 '11 at 20:35
  • I have noticed this, the QNX API integration is pretty poor, it's an absolute pain having to work with QNX containers in code and align them with the mxml placed componenets in the designer. Since I have switched to an alternative solution (disable orientation) I can't test this answer now and as such am unsure as to whether or not I should accept it. – Hamid Aug 26 '11 at 09:33