Archive for September, 2011

Chad Upton

Adobe AIR 3 Promises Console Quality Gaming on Mobile Devices

Wednesday, September 28th, 2011

By Chad Upton - senior consultant

Adobe’s latest iteration of AIR can be summed up in one word: epic.

The features in this update are very exciting for developers and users of AIR on desktop and mobile. For developers, there’s no doubt that AIR is the easiest way to build an app with native capabilities that runs on multiple platforms (Desktop, Android, iOS, BB PlayBook… etc). For users, this means the app should be available on your platform of choice right out of the gates. With these improvements, the potential is greater than ever.

The AIR 3 release candidate is currently available for download and we expect the final release to be available soon.

Here are the AIR 3 updates for mobile:

  • Native extensions
    • Write native code that can be called from your AIR app
  • Hardware-accelerated Video
  • Native Text Fields
  • Front-facing Camera Support (already supported on BlackBerry PlayBook)
  • Encrypted Local Storage (already supported on desktop)
  • Device Speaker Control
    • Selective output to speaker or headphones
  • Android specific updates:
    • Android Market Licensing Integration
    • Captive Runtime Bundles (Bundle the AIR runtime with your application if you want)
  • iOS specific updates:
    • Background Audio Playback (already supported on Android)
    • CameraRoll support for iPad

Some of the updates apply to mobile and desktop:

  • Native JSON Support
  • Secure Random Number Generation
  • Better Garbage Collection Control (all platforms)
  • Cubic Bezier Curve Support (all platforms)
  • Socket Improvements
  • JPEG XR Support
    • Better color, compression and support for transparency and loss-less encoding
  • Higher Resolution Bitmaps
    • Size now limited by the operating system itself

There some powerful desktop only updates too:

  • Stage 3D
    • Native 3D GPU rendering support
  • H.264 Video Capture/Encoding (desktop only)

The AIR for TV playform has some updates too:

  • Surround Sound Output – DTS 5.1 and Dolby Digital 5.1 Support
  • Advanced Controller Support
    • Get an event when a button on the  TV remote is pressed

For online and in-person Flex and AIR training, checkout our course finder.

edv

NTG a Silver Sponsor at RIM DevCon

Tuesday, September 27th, 2011

New Toronto Group, an Elite RIM Partner, is pleased to announce that we will be a Silver Sponsor at the RIM DevCon event in San Francisco, Oct 18 – 20.

In addition, Oliver Merk (NTG’s Principal Consultant) and Rod Nolan (NTG Senior Instructor) will be leading special one day pre-conference training sessions on October 17 on how to develop PlayBook applications using 1) Flex & AIR or 2) WebWorks.

BlackBerry DevCon Americas 2011

Rod Nolan

Debugging WebWorks applications using the PlayBook simulator and Google Chrome

Saturday, September 24th, 2011

By: Rod Nolan

I encountered an error recently while working on a WebWorks project. So I broke out the PlayBook WebInspector (aka Developer Tools in Google Chrome) and got to work… sort of.

In case you haven’t discovered this yet, to use the debugging tools in Chrome, you just launch your application in the simulator and then open Chrome and connect to the simulator over port 1337 (http://{simulator IP address}:1337).  You should see a simple page with a single link and when you click it, you’re connected to the running application.

Connecting to the PlayBook WebInspector

Connecting to the PlayBook WebInspector

This usually starts the Developer Tools in Chrome complete with Console, Script Debugger, Profiler and all the goodies you know and love. But this time around I got a nearly empty page… a blank toolbar area and the toggle buttons at the bottom of the page that didn’t work.

Where are the Chrome Developer Tools?

Where are the Chrome Developer Tools?

Hmm, this worked last week?! What changed?

I confirmed that the Chrome Developer Tools worked as expected with a regular public web site.

Then I tried a different version of the PlayBook simulator since I have two:

  • version 1.0.1 (from the BlackBerry WebWorks SDK for TabletOS 2.1.0.6)
  • version 1.0.6 (from the blackberry-tablet-sdk-1.1.0)

But both simulators produced the same result.

Maybe it was Chrome? You probably know how Google Chrome just silently updates itself without asking. (Can software be arrogant?)

The solution turned out to be this:

  1. Completely uninstall Google Chrome.
  2. Go find an installer for an older version (oldapps.com).
  3. Install it and get back to work.
PlayBook WebInspector works as expected in Chrome ver13

PlayBook WebInspector works as expected in Chrome ver13

Happy debugging. But keep that Chrome (Lucky 13) installer around and be ready to undo the auto update.

Thanks to Oliver Merk, NTG principal Consultant, for discovering this fix.

Derek Santos

Object Oriented JavaScript – Part 2

Monday, September 12th, 2011

By Derek Santos – Consultant

Go to Part 1
Go to Part 3

In a previous post, I covered the basics of Object Oriented JavaScript. In this post, we’ll take a closer look at inheritance.  Remember that JavaScript is a prototypal language. Instead of the traditional “is a” relationship, JavaScript inheritance has a “is now a” or “has become a” relationship.  The reason for this is that JavaScript is an interpreted language, and does not get compiled.   In classical OOP, inheritance means a subclass “is and has always been a” type of its superclass.  In JavaScript, an object always starts off as an independent entity and can then be assigned a relationship to some other object.  Let’s look at some examples.

Inheriting from another object

To make an object inherit from another object, you use the objects prototype property.

function Device() {}
Device.prototype.startUp = function () {
    alert('device start up');
}

function AndroidPhone() {}
AndroidPhone.prototype = new Device(); //AndroidPhone inherits from Device

var device = new AndroidPhone();
device.startUp();

Overriding methods

To override a method, simply define it in your new object.

AndroidPhone.prototype.startUp = function () {
    alert("AndroidPhone starting up...");
}

Calling methods on the superclass

There is no super property in JavaScript (unless you create one yourself). Instead you need to use the “call” method.

AndroidPhone.prototype.startUp = function () {
    Device.prototype.startUp.call(this);
}

The call method accepts an argument specifying the this property. It is used to define the context in which you are calling the method. In this case “this” will refer to AndroidPhone.

Digging Deeper

There’s a lot you can do with JavaScript inheritance. There are countless examples and libraries out there that try to make OOP in JavaScript easier and more streamlined. In my next post, I’ll take a look at some of those libraries and see how OOP in JavaScript can be made easier.