Skip navigation

Category Archives: lfpug

For a change, this month’s LFPUG didn’t actually feature any Flash. Instead, we were presented with an introduction to iPhone application development with two single-hour talks delving into developing with Objective-C and the Cocoa Touch environment, but all specifically tailored to take an approach designed for a Web developer’s perspective.

I really don’t know how I feel about iPhone development, as a Flash developer, anyway. There’s been a lot of ‘iPhone for Flash developers’ or ‘Actionscript for the iPhone’ or similarly titled tutorials spring up around the Web lately, which I guess have come about on the back of the over night success stories from applications booming in popularity and the ease with which the App Store lets a small dev team get equal distribution and visibility of their application. But why Actionscript?

The profitability is understandable, I just think it’s strange that specifically Flash developers assume that iPhone development is something they can or should be laying claim to, that it’s something within their domain or their right to be creating these apps? It’s gotten to the point where a Flash platform meeting is hijacked (hijacked isn’t the right word, it wasn’t unwelcome and it drew the biggest turn out I’ve ever seen) – is it selfish (?) that there’s such a demand for tutorials to be made easily digestible for them, when traditionally any other kind of development is usually approached by everyone else peaking in?

I’m not sure, I can’t decide. Maybe it’s more honest – that instead, for example, it’s the look and feel, the slick presentation layer and the interactivity of the interface that’s so attractive (it’s Flash-like) – and a lot of people do start playing with Flash because it looks good. Flash is inherently a visual platform. Maybe Flash just is the closest platform and Flash development easily lends to iPhone development.

Whatever the case, thinking as a platform-agnostic programmer, I was looking forward to the meeting. I have an addiction to learning (or trying) new languages even if I needn’t, plus it was honestly disclosed that this week there would be no Flash content an iPhone 101 bent into shape for Flash developers to understand, it would be was tailored for Web developers generally – I was hoping for more conceptual comparisons rather than perhaps just pointing out syntactical differences – either way, curiosity had the better of me.

First up was Masi Woermann starting with An Introduction to iPhone Application Development. He introduced the broad concepts of iPhone development and the different approach developers must under go to create applications mainly looking at the workflow. Being primarily a Flex developer, Masi maintained comparisons between the architectures of a Flex app and an iPhone app – drawing parallels between Objective-C and Actionscript coding and their relationship to the UI components created with Interface Builder versus MXML.

He introduced the development tools and iPhone SDK, discussed some basics of Objective-C (pointers, memory management, classes) and eventually produced a very simple application – demonstrating the basics of interacting with visual components, straightward methods, getters, setters – some simple OOP.

It was good to see some hands on coding and that, obviously, although it’s a completely different kind of development – it might be intimidating but it’s not impossible. Watch it here:

Masi Woermann - An Introduction to iPhone Application Development

Then Matt Biddulph presented iPhone Development for Web Developers. Matt is primarily server-side developer working with the likes of Python, Ruby and Rails, but instead of going into any code expressed that his real interest in iPhone applications lies in the device’s connectivity, specifically the capability to connect to the Web and interoperate and network with data and objects found there.

He looked at the applications that Twitter and Facebook developed, quoting Joe Hewitt‘s development wisdom with his work at Facebook.

He also criticised some of the failures of the current SDK, as Hewitt also did, specifically that some of the native features that you’ll see in Apple’s applications still aren’t available for third-party developers to utilise. I hadn’t realised this was the case, or would have thought Apple would hold back on anything – I guess with later releases more features will become available. The iPhone OS 3.0 SDK is due for release this summer, perhaps more will become available then.

Watch Matt’s talk here:

Matt Biddulph - iPhone Development for Web Developers

Matt also mentioned Phonegap, an open source cross-platform mobile framework for building apps with JavaScript. It’s been labelled as being ‘like AIR for the iPhone‘ and operates on Android and Blackberry, too. Again, maybe it’s just be another means to cut a corner and not develop with the native environment, but it looks impressive – and it seems powerful. You can take advantage of all the core features of the various platforms – geo-locations, the accelerometer etc.

It’s also created entirely by by Web developers. As the video on their site claims, there’s not many Objective-C developers but there are a lot of Web developers – so in keeping with the rest of these observations, there really are more and more opportunities and points of entry for Web developers to get into mobile and iPhone app development, it’s purely demand that has created these.

All in all, whether it’s ‘in favour’ or not for Flash developers to want to develop iPhone apps is probably irrelevant – whether its a for profit or to expand a skillset probably doesn’t mater either. Hopefully all the attention will cause a shift in the perception of developing for mobile devices in general, I know I still cringe whenever anyone mentions Flash Lite – but it seems that’s starting to enjoying the beginnings of a resurgence too.

Then I think of initiatives like Adobe’s Open Screen Project and think this could be a really exciting time for mobile devices regardless, maybe there’s just so much fuss over the iPhone right now because it’s the iPhone.

As I write this post an email has just arrived in my inbox announcing there’s new group meeting specifically for developing iPhone, the London iPhone Bootcamp – ‘part seminar, part hackathon, part workshop’ – they too, are looking for the next killer iPhone app!

Thoughts?

Advertisements

Last month’s Flash platform group meeting was presented by Michael Plank and Frank Piotraschke from Powerflasher, authors of FDT the Actionscript IDE plugin for Eclipse. One of many features of FDT Frank demonstrated was SWC and SWF(-ish) browsing support.

He opened debate as to whether adopting a SWC or SWF nominated workflow for handling compiled components and libraries is more desirable, presenting methodology for both. Although then a decent excuse for him to show off FDT, each approach has its benefits and it’s good to know how to code both – previously I’d never used SWFs in this way, always choosing SWC files.

To use a SWC as a linked library and access a clip as a dynamic class, establish a linkage in the library to a class definition that does not exist – for example:

com.hibbins.Clip

When you click the ‘Validate class definition’ tick, you’ll get an alert that the definition cannot be found and it will be automatically generated upon export. Export the SWC and add it to your project classpath and it’s ready to use. Just instantiate it as you would any other class, note the import if your packaging requires it:

package
{
import flash.display.Sprite;
import com.hibbins.Clip;

public class SwcTest extends Sprite
{
public function SwcTest()
{
var clip:Clip = new Clip();
addChild(clip);
}
}
}

To do the same with a library from a compiled SWF, you need to load the SWF file containing your assets into the same Application Domain as your loading SWF file. The following diagram represents the classes available to each SWF file considering their respective domains:

Application Domains

The SwfTest class exists within the loading SWF file, the Clip class in the library file (published as assets.swf). Loading the file in to the current Application Domain shared the loaded SWF domain classes within the main class pool:

Application Domains

The following code demonstrates how to do that, then instantiate the class with the getDefinitionByName method:

package com.hibbins
{
import flash.display.Loader;
import flash.display.MovieClip;
import flash.display.Sprite;
import flash.events.Event;
import flash.net.URLRequest;
import flash.system.ApplicationDomain;
import flash.system.LoaderContext;
import flash.utils.getDefinitionByName;

public class SwfTest  extends Sprite
{
public function SwfTest()
{
var loader:Loader = new Loader();
var context:LoaderContext = new LoaderContext(false,
ApplicationDomain.currentDomain);

loader.contentLoaderInfo.addEventListener(Event.COMPLETE,
onLoadComplete);

loader.load(new URLRequest(“assets.swf”), context);
}

private function onLoadComplete(event:Event):void
{
var ClipClass:Class = getDefinitionByName(“com.hibbins.Clip”)
as Class;

var clip:MovieClip = new ClipClass();
addChild(clip);
}
}
}

Both are pretty quick ways to handle custom MovieClips from your library dynamically. If you want to add any functionality to the clips you can write their classes using matching definition paths. Be aware though, any timeline actions will be dropped if you do this.

If you really want to keep frame actions, I’ve found two ways – firstly by using frame labels which are maintained elsewhere and coding around those, the other only works with SWC files, creating a class which extends from the dynamic clip class. With the SWC in your class path you won’t have any compilation errors.

As Frank pointed out, SWC files can be a lot heavier when loaded on application startup which can make your main SWF quite large. Using SWF files over SWCs, you can create an sequential load manager or only load them asynchronously when necessary. Also, with SWCs being relatively new in comparison to SWF use, you might have no choice. On the other hand, the SWC workflow is simpler and many IDEs have some form of SWC explorer – FDT and Flex Builder, for example.

There’s also an a shortcut to display the contents of a SWF in the same way in FDT, though it’s undocumented. Hit Alt+Shift+W and you can get an outline view (I don’t think this works on all versions of FDT though). It would be good if when this is better integrated into FDT, the classes are recognised in a similar way to the SWC support for auto-completion – as Tink says in the video, to avoid the ‘flakey’ long line of code that’s easily prone to mistyping.

Presentation slides, source code and videos are now online [via].

Managed to get to ExCeL last night to see Kevin Rose and Alex Albrecht’s first live Diggnation in the UK. Can’t say I’ve ever watched one but went along anyway and it was pretty good stuff, I’m now subscribed 🙂

I only caught one half of LFPUG this month, Jolyon RussIntroduction to AS3: The First 5 Things You’ll Want to do With ActionScript 3, unfortunately missing Tink‘s Papervision3D Effects for Flex – he’s recently posted a promise to upload the source soon though.

I’ve recently found and registered with the London Flex User Group, who’ll next be meeting on October 10th – looking forward to it!

Update (10.10.07): Tink’s source files and a video of the presentation can be found here.

So last night I attended my first London Flash Platform User Group meeting at CosmoBar, EC1. The idea of the group is to bring together like-minded developers to discuss, demo and practice what’s new in the Flash world.

Last night’s chat was made up of two presentations, Cairngorm: Making a Molehill out of a Mountain from Neil Webb and Can Code, Will Code: Flex Application Development in 60 Minutes by Mike Jones – both exploring and providing me with my first real insight into Adobe Flex.

Neil Webb introduced Cairngorn, an open source architectural framework for Flex. Thankfully colourfully analogised, it’s essentially a complex augmentation of an MVC model. Like I said, being new to Flex it’s specificity gracefully flew over my head but there’s obvious merits in extrapolating processes and good OOP. I’ve recently been working with Drupal so could appreciate it’s granularity – and like Drupal – Webb admitted it excels in some applications but for smaller projects can be overkill. Presentation slides (and blog) can be found here.

Then came the workshop! Mike Jones is Head of Development at London agency Mook. He remained confidently ambitious that a Flex app can be created in an hour – even for a complete newcomer – albeit with the help of a very small amount of Blue Peter style pre-prepared source.

One of only a few to draw out a laptop and attempt to the challenge I completed it with modest success. Admittedly when the hour overran and Mike rattled through the final touches, a couple of lines I merely copied down, the majority I comprehended. The tutorial was thorough, if indeed entry level and the final outcome a relatively simple drag and drop photo sharing app.

Anyway, good to meet other developers and finally get involved with Flex and MXML. I also got secret sneaky peak at next month’s presentation – I look forward to it!