Text Layout Framework Follow Up and Request

UPDATE: I’ve posted a solution to this PureMVC + Text Layout Framework integration here (this applies not just to PureMVC, but anywhere you want to use your own “undo” stack in an MVC application).I’m having a bit of a tricky time with integratin…

UPDATE: I’ve posted a solution to this PureMVC + Text Layout Framework integration here (this applies not just to PureMVC, but anywhere you want to use your own “undo” stack in an MVC application).


I’m having a bit of a tricky time with integrating the TLF into an application which already has an “undo” system. The TLF has itself an UndoManager, but more on that later… Continue reading “Text Layout Framework Follow Up and Request”

Introduction to the Text Layout Framework

I’ve been using the TLF for the last day, and it’s really a major leap forward from the limitations of the TextField class introduced in Flash 6. TextField still has its uses, it’s most likely more processor friendly (unconfirmed). But if you’re in need…

I’ve been using the TLF for the last day, and it’s really a major leap forward from the limitations of the TextField class introduced in Flash 6. TextField still has its uses, it’s most likely more processor friendly (unconfirmed). But if you’re in need of some of TLF’s advanced features like bi-di text (or complex script like TCY elements), support for flowing text between multiple columns and containers, better handling of in-line images, advanced styling of things like ligatures, superscript, and tracking, then TLF is for you.

The key thing for me was understanding how these key concepts fit together:
Continue reading “Introduction to the Text Layout Framework”

The View-Model-ViewModel Pattern

Yes, another pattern, but I’ve just come across a great post on the M-V-VM pattern and it’s a good one to share. I was introduced to the V-M-VM pattern just under a year ago by an outstanding .NET dev when we worked together on an RFID/database powered W…

Yes, another pattern, but I’ve just come across a great post on the M-V-VM pattern and it’s a good one to share. I was introduced to the V-M-VM pattern just under a year ago by an outstanding .NET dev when we worked together on an RFID/database powered WPF application (pics), and I have to admit it worked *really* well, I was utterly convinced by this concept with regards to WPF developement. (Link to article at the end of this post.)

So what is it? Very much a spin on MVP, it’s a descendant, to some extent, of the classic MVC pattern. The aim being to create very simple View classes that are separated from the Model by another entity. Not the controller per-se (more on that in a moment) but a “ViewModel”, a model specifically for a View. The View’s sole data source resides in its ViewModel, this can do things like perform validation, turn raw data into visually relevant data (the classic Martin Fowler-esq example being a thermometer view that changes the number value displayed from blue to red when the temperature goes over 20 degrees – resolving the issue of why store this colour in the [real] model when only the View cares), it also bridges the View to the Model whatever that might be and however that might change in future.
Continue reading “The View-Model-ViewModel Pattern”

CSS and AS3: Careful with Whitespace

Small bug here, it looks like the built in StyleSheet CSS parser in Flash doesn’t use a trim() or a more complex regular expression when parsing a CSS string/file. If you’re a whitespace fan this can lead to your style properties, such as “fontFamily”, a…

Small bug here, it looks like the built in StyleSheet CSS parser in Flash doesn’t use a trim() or a more complex regular expression when parsing a CSS string/file. If you’re a whitespace fan this can lead to your style properties, such as “fontFamily”, actually being indexed in the style object as “fontFamily ” (notice the space at the end).

This doesn’t affect the regular dot notation access (style.fontFamily). But it can cause problems if you’re iterating through the style object.

This small glitch can be illustrated by the following two snippets of almost identical code. This first one shows the correct behaviour when no extraneous whitespace is used in the CSS:
Continue reading “CSS and AS3: Careful with Whitespace”

Cliff Hall on PureMVC – Video

I’ve got a stack of posts scribbled over some paper that I’ve been meaning to blog about for months now regarding the MVP pattern (and ViewModels). But more on that later, because what is core to MVP is of course MVC, that most misunderstood of “patterns…

I’ve got a stack of posts scribbled over some paper that I’ve been meaning to blog about for months now regarding the MVP pattern (and ViewModels). But more on that later, because what is core to MVP is of course MVC, that most misunderstood of “patterns”…

Well this one is for new-guns and MVC vets alike, Cliff Hall presents on MVC as it is applied in PureMVC, perhaps one of the most refreshing frameworks to come to light in the Flash realm, and it is spreading to many other languages, ports include Python and even JavaScript/JQuery in the works.

I’ve started a re-write of a desktop application I worked on some years ago that was around 50,000 lines of AS2, I can’t even remember how many commands were in there but it was quite heavy and the “front controller” took a battering, so it’s a good challenge to put these concepts into practice and take advantage of the new possibilities, such as web and AIR deployment from the same code-base.
Continue reading “Cliff Hall on PureMVC – Video”

Genetic Algorithm Evolves Better Car Using Flash

Caught this over at BoingBoing, it’s a nice Flash-based simulation that runs through rapidly evolving a vehicle design, using a physics engine to test the thing out over some terrain (not sure whether it’s home-rolled or one of the big ones).

Quot…

Caught this over at BoingBoing, it’s a nice Flash-based simulation that runs through rapidly evolving a vehicle design, using a physics engine to test the thing out over some terrain (not sure whether it’s home-rolled or one of the big ones).

GA Car

Quote from BoingBoing article, from Matthew the author:

“This is a GA I wrote to design a little car for a specific terrain. It runs in real-time in Flash. The fitness function is the distance travelled before the red circles hit the ground, or time runs out. The degrees of freedom are the size and initial positions of the four circles, and length, spring constant and damping of the eight springs. The graph shows the ‘mean’ and ‘best’ fitness.”

Check it out here.

Flash Player Settings: Flash and Silverlight Comparison

One of the little pet peeves I seem to share with other Flashers is the frankenstein-like html/flash settings manager pages that you have to access via Adobe’s site. This is the thing you see when you right click a Flash movie and choose “Settings” -> “A…

One of the little pet peeves I seem to share with other Flashers is the frankenstein-like html/flash settings manager pages that you have to access via Adobe’s site. This is the thing you see when you right click a Flash movie and choose “Settings” -> “Advanced”. It allows you to trust certain locations on your hard drive, delete “Flash cookies” (LSOs) , auto-check for player updates and other tasks.

The thing is this thing really looks and feels old now (it’s an FP6 file and it shows), it seems strange I have to be online and visit a site to delete files the Flash Player creates on my hard drive… if it’s a chore for a Flash dev, what’s the chance someone else can use it, particularly if people are storing sensitive info in there (bad devs!). I just got pinged a link to a Silverlight site and as I had to update to 2.0.something so I thought I’d check out the new settings panel (below, click to view full size):

Silverlight 2 Settings

I think you’ll agree much better all round. Very clear, and more importantly I don’t have to browse to another website to use it. Adobe, can we see an updated version of the settings panel for Flash Player some time soon? Perhaps a column to sort by usage/date too so you can quickly delete older LSOs. Perhaps there’s a really good reason for it and I’m just missing the obvious.

getDefinitionByName() Fails in SWFs Loaded Into Another SWF (Solution)

Just a quick note for future reference. When you are using getDefinitionByName(“ClassName”) inside a SWF that is being loaded into another SWF, it might not find the symbol from its own library (see ApplicationDomain and LoaderContext for why).The so…

Just a quick note for future reference. When you are using getDefinitionByName(“ClassName”) inside a SWF that is being loaded into another SWF, it might not find the symbol from its own library (see ApplicationDomain and LoaderContext for why).

The solution is to get a reference from the ApplicationDomain of the SWF being loaded using the getDefinition() method. So the code:

var mySymbol:Class = getDefinitionByName("MySymbol");

becomes…

var mySymbol:Class = loaderInfo.applicationDomain.getDefinition("MySymbol");

Hopefully that resolves any issue you had with getDefinitionByName(). Of course you’d use a similar mechanism to work the other way around, and get at classes inside a loaded SWF. In this case it would be loader.contentLoaderInfo.applicationDomain.getClass()… however this depends on what ApplicationDomain you’ve loaded your child SWF into (see LoaderContext class).

In my case I wanted to attach a different “scroll thumb” symbol for each section SWF in the site I’m working on, so I couldn’t just use a single runtime shared asset.

ActionScript and ECMAScript 3.1/4 – Inter-op is the Key

Like many other Flash devs I’ve been following the discussions surrounding the ECMAScript 4 decisions and the Harmony project quite closely. There are a few bloggers out there that appear to be stating that ActionScript will become divorced from the stan…

Like many other Flash devs I’ve been following the discussions surrounding the ECMAScript 4 decisions and the Harmony project quite closely. There are a few bloggers out there that appear to be stating that ActionScript will become divorced from the standards. To be honest only Adobe can decide that, but either way, that’s only half the story. In particular, it does not mean that ActionScript will not be able to inter-op, and that’s key…

Here’s a Google Spreadsheet containing the votes by Adobe, Mozilla, Google, Apple and most controversially Microsoft regarding the various features of ECMAScript 4, such as the notion of packages, new operators, and so on. So clearly everyone not in agreement, everyone with their own valid opinions and vested interests. And you can see already that there are rejections in the feature set of ECMA4 that AS3 has already implemented.

So does ActionScript 4 have to take a side step (and maybe a step backwards) to get in line? It doesn’t really matter. Whilst it’s nice to be able to jump between languages without having to change your mindset at all, it’s not a big deal. What is essential is that you can call functions and pass objects between those two VMs, or indeed, share the VM. And forgive me if I simply don’t understand enough about how this sort of thing works (very likely), but this is still possible.

Indeed right now we can very easily inter-op between the very old JavaScript 1.5 and ActionScript 3 via ExternalInterface. Yes there are limitations, but both environments (Flash and HTML) have many unique features and extensions that simply don’t cross the boundary very well. For example the HTML DOM (having said that you can still control it, see AIR), or in the case of Flash, cutting edge features like 3D, Adobe Pixel Bender (Hydra), or even simple Bitmap effects. Now I know these are not language features at all, but they are part and parcel with how we as developers use our language every day, and so there is no harm at all in having extensions that are unique to one environment, as long as they do not conflict with a similar feature of another. One example here is packages and namespaces… AS3 has them, it doesn’t look like JS will get them, but so what, as long as the code is similar enough to understand, porting code can be automated, and at the very least inter-op can still be easily achieved the fact that they differ is small fry.

Personally I would say the challenge now for Adobe will be to continue to develop ActionScript into a feature-rich language, whilst making sure it doesn’t begin to conflict with the ECMAScript standard it runs in parallel to. The nature of JavaScript following the committee-led ECMAScript standard means this is going to happen again and again, the process is simply too slow. Adobe (and now Microsoft) have set a new pace for the web.

Meta4orce – Papervision Site for the BBC

I just caught this site via the blog of Iain Lobb (head of interactive at Bloc Media) who commented on my last post. It’s an incredibly slick site developed using the Great White branch of Papervision3D. The site is (for) a TV and online cartoon series,…

I just caught this site via the blog of Iain Lobb (head of interactive at Bloc Media) who commented on my last post. It’s an incredibly slick site developed using the Great White branch of Papervision3D. The site is (for) a TV and online cartoon series, providing a nice cross media experience.

The main things that stood out for me were the production quality of the games and the audio which is very high quality and just as importantly, very well integrated.

Shock to the System

There’s a game for each episode, the “Shock to the System” game is the last item in the Episode 2 menu, and reminds me somewhat of Tron. (Speaking of which, Tron 2 looks like a must see!).

You can read more about the development of the site over at Iain’s blog. Congratulations on the great work.