Making Apps – Part 2

When I started writing this post, I realised it was a case of tl:dr (too long, didn’t read – just in case you didn’t know).  I say I realised, my wife leaned over and said “Really?   tl:dr much!”

Loved ones, always the harshest critics 🙂

So, where was I.   Oh yes…

3) Adobe Flash CS5 and Adobe AIR

Flash.  Aha!  Saviour of the internet!

Adobe Flash

I love Flash, although I seem to be in an ever reducing minority, which no longer includes Adobe for some reason.  I think I know why – Flash in webpages on mobile devices isn’t as responsive as it feels like it could be.  There are resizing issues and supposedly it causes crashes, although I’ve never experienced a browser crash because of Flash.

Apple have blamed Flash for being too RAM intensive to be safely included on their iPhones and iPod Touches.  This decision had the happy coincidence of closing off thousands of free Flash games just as Apple were launching their App Store full of paid games.

As a development platform, Flash is second to none.  I said previously that only Apple understands about wrapping up everything you need.  Well I have to include Adobe as well in that exclusive club.  Flash combines graphics, animations and coding very easily and with the downloadable Adobe AIR for Android plugin folds in app making too.

Flash CS5 also comes with the ability to make Apple iOS apps.  Unfortunately, due to restrictions imposed by Apple, (you need a certificate which can only be create on a Mac, you can only upload to the App Store from a Mac) .

Using Adobe AIR to make apps is simplicity itself.  You open a new file, using the AIR for Android template.  From here, you build your Flash file as usual.

Adobe Flash start screen

At this point, I need to point out that out of the box, you don’t get AIR for Android as a template (at least not in CS5).  I seem to remember being alerted to its existence by a popup on this screen.   I do remember adding it via Adobe’s Extension Manager and unfortunately, the Developer Site doesn’t make it clear how to get it either.  Maybe it’s just bundled in.

Note from this screen you can also make iPhone OS apps and standard AIR programs to run in Windows.  All three are pretty identical and just differ in their publishing settings.

AIR for Android's publishing settings

When you open the AIR for Android template the stage is automatically set to 480 x 800 which is the most common screen resolution for the Android platform.  Of course, you can alter this easily.

There are four templates included with Flash, one is plain, but the other three contain code examples showing how to use a mobile device’s accelerometer, its menu button and a swipe gallery.  Between this, my own knowledge of ActionScript 2.0 and the internet, I was able to build a number of apps, such as the Question Dice.

ActionScript

The programming language for Adobe AIR is ActionScript 3.   This is really unfortunate for me, because I learned the previous language ActionScript 2.   AS2 is a much simpler language to learn, its grammar is less precise and how it functions is fairly straightforward.

AS3 is much more complex, designed with professional teams in mind, not individual programmers.  To this end, it is incredibly intimidating and the general advice on internet forums tends to be irrationally anti-AS2 style.  I’ve seen a number of posts from novice users, asking perfectly reasonable questions only to be shouted down with cries of “you shouldn’t be doing it like that at all”.

Years ago, I was similarly shot down for asking a question about linking one scene to another.  The response was “you should be using scenes”.  Now, I have the confidence to question that.  If you’re not supposed to use scenes, why does Flash include them?  Personally, I very rarely use scenes now, but if I needed to I still would.  The moral of this story is ignore all negative comments on the internet.  The trolls are never right.

The Truth (read it quick before I’m silenced)

Well, I’m finally learning AS3 and firstly, everything you’ve read about team programming and OOP and the “right way” to do things is rubbish!

AS3 is almost as forgiving as AS2.  Public functions, private variables and separate .as files are only needed IF you are writing complex games AND you use a separate .as file.   It came as a bit of shock to me.  The so-called right way is simply one way.

You can happily code in AS3 on the timeline.   If you do use code from a tutorial and run into compiler warnings about public functions, just remove the public bit.

public function startgame() {

}

becomes:

function startgame() {

}

if you’re placing code on the timeline.

Oh and regular functions, not connected to mouse clicks can just be written as AS2 functions. Rely on the Code Snippets box too, it really useful to get started.

Where to go from here

The book I’m using is an update of the book I learnt AS2 from.   It’s called Actionscript 3.0 Game Programming University.

ActionScript 3.0 Game Programming University

The author, Gary Rosenzweig has an excellent, easy-going style.  He provides the full code for each game, but breaks it down ito what each section does.  Something I liked from his original book is that each game only takes you so far, but it’s always easy to see how to develop each game to make them better.

Next time

My wife was right.  This post has become its own mini-series.

In part 3, I’m going to show just how easy it is to produce an app and publish it on your VLE and the Android Market

Advertisements

2 Responses to Making Apps – Part 2

  1. […] full Adobe Production Premium suite which includes Flash CS5, which I’ll talk about in Part 2. Advertisement GA_googleAddAttr("AdOpt", "1"); GA_googleAddAttr("Origin", "other"); […]

  2. […] this ever increasing series, we now come to the fun part.  All the hard work is done.  You’ve coded in Adobe AIR, […]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: