Skip to main content
Known Participant
March 28, 2011
Question

Single Set of Code for BlackBerry PlayBook too

  • March 28, 2011
  • 1 reply
  • 497 views

I'm looking at using the same code for all devices in MobileApplication development.

I'm found some solutions for resizing and this app was never wanting to be oriented sideways.

With the BlackBerry PlayBook it seems the res is 1024x600 which is a sideways orientation!?!

Typically as I've mentioned before it seems even deeper in my inital SplashScreen View's creationComplete init function There still isn't a stage variable properly initialized yet (that seems very wrong).

Still I'm not sure how it's best to programatically set this before initalizations. Really for that devide it's starts in a Sideways_Orientation (not declared.. thinking of a solution to understand when it's backwards?)...

Anyway after some inital tests of doing something like this in a timer waiting for a stage to randomly appear...

        public function checkStageOrientation(te:TimerEvent = null):void {
            if(creator.stage != null) {
                if((creator.width / creator.height) < 1 && creator.stage.orientation == StageOrientation.ROTATED_LEFT) {
                    creator.stage.setOrientation(StageOrientation.DEFAULT);
                }
                else {
                    creator.stage.setOrientation(StageOrientation.ROTATED_LEFT);
                }
            }
        }
I still see damaged components probable because orientation doesn't change the width and height values?... That seems wrong.

So what other then building a separate mobile application project (undesirable), do we do here.

Basically I'll take this time to add...

I know the world changes fast, and this is a great example for sure.

Basically my feelings are I never want (possible never will) to build anything but one applicatiuon that works on all plateforms.

Not building for the Mobiles would seem foolish (at least today and likely in the future).

Yes one app can work for all mobiles thanks to Flash (you rock).

I hope that I can use the MobileApplication class on the Desktop as AIR directly with 2.6+ (I think you can or we'll put Application with a Navigator it seems).

I will likely battle with a sandbox or disable stuff porting to a Web Delivered version as the best and only way to reach even more people and demonstrate the applications ability.

So long and short is I won't be able (or bothering) to deploy this on the PlayBook without this working and I'm afraid my custom MobileResizing Class will likely need to flip and flop the width and hieght based on orientation and which is wider or taller.

Basically I think I'm suggesting something like alternate Orientation Types and/or that width and height flip with orientation (I think that the problem and my expected behaviour). Or my problems are related to an earlier post about why the stage isn't ready when calling creattionComplete.

Basically it's a new wrench in the gears or inital optimizations, I don't it was expected to want to know and change orientations on the fly.

This topic has been closed for replies.

1 reply

as4moreAuthor
Known Participant
March 30, 2011

Even though I discover addedToStage it didn't mean that stage wasn't null?! at least when starting up in AIR as MobileApplication.

I've been hacking around with the text scaling when scalling the View contents and am embarased to show what I'm using but I know it's not perfect.

For whatever reason I don't think I'm the one that should be enbarased because I manged to get it working okay for now with ...

                ta.height = ((mtf.numLines * tlm.height) * ((0.84 + (0.27 * (mobAdaptor.scaleY - 0.49))) / mobAdaptor.scaleY));


I'd rather not understand it or exaplain it at this point, but again despite the battles that shouldn't be it's getting close to good. (One set of code for all platforms and devices).

Now I've also discovered/believe(?) the Xoom is wider then tall as it's default orientation so it's mildly more worth my efforts.