I’m in the processing of updating the Meetup Search application for the BlackBerry PlayBook. Last night I was busy trying to rearrange the search form options and realized that the mx:UIComponent was not returning width or height back in order to determine where to place the next component. The qnx library used for the PlayBook require that an application be either completely in AS3 or use the mx:UIComponent to add the qnx fields; button, textinput, toggle switch, etc… When developing the Meetup Search, I figured that using the mx tags, it would be easier to control the layout and possibly make it easier to convert the application from a PlayBook application to an Android application. That doesn’t seem likely now, but I can always use the behind the scenes items to build the application, but the interface will have to be redone for each device.
Anyway, my initial thought was to create a mx:UIComponent for each item I wanted to add to the screen. Since I wasn’t going to use all qnx components, this seemed logical. Then last night I decided that I would use all qnx components and add them dynamically in order to change the text, size and position based on portrait or landscape layout. When I discovered that the mx:UIComponent wasn’t returning height or width, I pondered if I could just use one mx:UIComponent and add all the qnx items to that. Well, that’s exactly what I can do. All components are added and can be repositioned and sized with just the one. Hopefully this will keep down the application size and cause less problems. Of course, it doesn’t make for a obvious layout design.
// Create Topic Picker topicsPicker = new Picker(); topicsPicker.width = 300; topicsPicker.setListWidth(0,300); topicsPicker.addEventListener(Event.SELECT, setTopicText); <s:Group id="optionsGroup"> <mx:UIComponent id="optionsHolder" styleName="menuAppLabel" /> </s:Group>