Orientation change with MXML

I have been banging my head on the wall trying to figure out how to detect the device orientation on the BlackBerry PlayBook.  I initially tried to use the accelerometer function.  Unfortunately, the listener would continue to activate and determining the exact orientation was a little iffy.  So, a slight move of the device would set off the listener and the redrawing of the screen would keep going until the accelerometer stopped.  This was not a good way to test for orientation, it will be a great way to make a game that required moving the PlayBook around a lot.  After days of searching the internet and the forums I finally stumbled upon the answer.

The way to check the orientation is to determine it through the stage.  However using the Sparks/mxml scripting and not the full as3 coding to make the application, getting to the stage information isn’t very straight forward.  If you trying to add a event listener to the stage as you would in as3, the you get a “null” object error, because the stage hasn’t been instantiated or something.  With the actual solution, you have to go a level above the stage to the systemManager.


systemManager.stage.addEventListener(StageOrientationEvent.ORIENTATION_CHANGE, onOrientationChanging );

From there, it is just a matter of determining the correct orientation and then updating the display.


private function onOrientationChanging( event:StageOrientationEvent ):void {
 if(event.afterOrientation == StageOrientation.UPSIDE_DOWN || event.afterOrientation == StageOrientation.DEFAULT ) {
stageSize(false);
 } else {
stageSize(true);
 }
 }

mx and qnx happliy playing together

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>

PlayBook and Meetup Search so far

I have 1 review from my Meetup Search application for the PlayBook and it points out that Canadian zip codes don’t work :( , so I need to get the search features updated.  I have made some updates, but haven’t uploaded the changes yet, since I wanted to test the changes directly on the PlayBook, which I received last Thursday.  Hopefully I’ll get the search updates soon and improve my ratings on the App World.

I spent the weekend traveling and the PlayBook came in handy while waiting in airports and flying in the plane.  I was able to connect to wi-fi locations at Raleigh-Durham (RDU) and Atlanta without any issues.  At RDU, I used my AT&T DSL wireless account to connect for free, which was very nice.  Most of the time I had an available power outlet, so I didn’t see how far the battery lasted. I tried BlackBerry Bridge using my sister’s BlackBerry Flip to connect to.  Connection was simple, but due to cell coverage, using the browser was not very good.  I tried using Bridge on my wife’s BlackBerry when I got home and the browsing experience was much better, which leaves me to believe it was the network out in Kansas.  Also, I didn’t realize that Bridge does not connect the internet for the applications ; something that should be done using tethering.  However, according to the article, that might change in the future.

I discovered that GMail voice mail will just download the recording to my music list instead of playing the message from the inbox.  I guess that’s helpful if I wanted to store the message and play it back.

After loading music on the PlayBook, I tried to find radio apps, but didn’t find anything that I wanted to use.  I tried the Slacker Radio application, but apparently there is still something wrong with the app or my setup ( cause it costs $3/month ).  I found a couple of streaming servers that I might try to create a PlayBook app for, they are Audio Galaxy and Subsonic. Both take your music files and stream them on the internet, but one does it via a system service and the other as an application.  The APIs for both look fairly straight forward, so if I come up with a good interface, then it might be possible to use it for both options.  So many ideas, so little time to do stuff.

I tried some podcast downloads on the PlayBook to see what that is all about.  I guess it would be good if you don’t have wi-fi and wanted to listen to something besides the music playlist.   I added BlackBerry Today and downloaded their latest episode.  Heard on BlackBerry Today podcast :   There were 3,000 PlayBooks applications available and 40 – 50,000 PlayBooks (corrected on 5/18 podcast) sold on launch day, which was the most for any tablet launch.   The 6,000 participants at BlackBerry World conference all got a free PlayBook.

Here is the download chart for the month of April for Meetup Search.   Not tremendous, but not too bad.  I think improving the UI and adding search options will help with the downloads.  Also, I need to make the description a little prettier.  I think the form allows for HTML, since I’ve seen others use bullet lists.

A message from PlayBook

Last night I received my free BlackBerry PlayBook.  I immediately downloaded the updates and began to familiarize myself with it.  The first thing I need to get used to is using my finger pad instead of my nails. Touch response is different than with my phone.  But, I am getting used to it.  After a little trail and error, I have figured out how to load music, photos and files from my desktop.  I have loaded a few free apps to help with the flight layovers I’ll have this weekend.  Later, I think I will give more of a review.

I can successfully report that Gigya sign in with WordPress works on the PlayBook browser. I typed this post using my PlayBook.

Animating the logo

After getting a wonderful give of Adobe Master Collection from my wife, I am slowly learning how to use the many tools available.  Currently I am using Premiere to edit the footage of The RTP “Let’s Make a Movie” Meetup project called “I Remember Hanna“.  The movie is around 10 minutes long, but it took us 2 months to get if filmed due to location issues.  So far, I have learned how to add the video and clip it for the appropriate shots.  When it gets done and everything is complete, I’ll add a post about it.

One thing I would like to add to the film is a animated logo for Dean Logic.  This would be the animated logo I would use for any film I direct or produce, which so far is every movie that the “Let’s Make a Movie” group is doing so far.  Of course, if I do a movie outside of the group, I’ll use the logo for that as well.  Anyway I’m trying to learn how to use the 3D effects available in After Effects.   With this video, I am using the CC Partical World.  I need to figure out how to change the spheres to light bulbs.