Monthly Archive for November, 2009

Page 3 of 5

AIR 2.0 Sockets demo

Check it out. When will we see the first web server running in AIR?

Unnamed functions

Why you shouldn’t use them. What’s more, every function call costs time, think about inlining simple functions code.

Faster Math.ceil()

For those of you who optimize every bit of code.

va.lent.in — what a flash developer’s site should be

valentin

A couple of weeks ago I released my new personal portfolio/sandbox site — va.lent.in. I need more opinions and less bug reports.

I like projects which make me learn something. During this one I learned a lot…

Continue reading ‘va.lent.in — what a flash developer’s site should be’

The easiest way to protect your code

I heard on Russian twitter that flash decompilers fail to parse embeded binary data (for example another SWFs). Tested it locally and that rendered to be true — the content of embeded SWF was impossible to extract. That seemed so simple yet effective. Just use something like

[Embed(source="swf.swf", mimeType="application/octet-stream")]

Someone could write a simple command line script to split SWFs into several parts to embed them inside a loader SWF and assemble again. Or it’s possible to add simple encryption to go further.

This idea is indeed very simple so someone might have made a tool like this already. I didn’t find a tool but I did find a post about this technique. And since then I successfully used it in one of my projects.

Entity Systems in games

This is really interesting read about so-called Entity Systems and Component Oriented Programming. The inheritance pattern described is close to how I planed to arrange stuff in my small indie MMO. But after I read the article I’m leaning more to use Entities and Components with Systems which control them as described.

Global object in AS3

Here the guy encourages to do what’s is strongly prohibited in AS3 — to use a Global object. Using such global objects is a VERY bad practice which can save you some time in a small project but will grow in a major pain in the ass later. I’d say he should write a warning at the repository page for newbies.

Open Source Media Framework v0.7

was just released.

Swiz as a job requirement

experience with flex frameworks that use MVC development – Swiz in particular. Swiz +1.

Is it possible to create a perfect tool with AIR?

Since there’s no perfect tool for me I decided to create one myself.

If you want something done do it yourself.

Right now the only platform I can create application for without additional training is Flash/Flex/AIR. AIR looks perfect for this purpose, but I doubt flash can handle some of the features I need. Here’s the list of features from my previous post.

  • Be able to create rich text nodes,
  • Insert images, movies, audio files and PDFs,
  • Have everything searchable,
  • Tag everything,
  • Be able to sort nodes to folders and smart folders,
  • Be able to crosslink files,
  • Add small notes (as clouds) to everything,
  • Annotate PDFs,
  • Have a usable intuitive interface,
  • Run on a mac offline.

AIR can run on Mac, with Flash I can create any interface I need, I can show images, movies and mp3 files, I can edit text in a WYSIWYG mode (though I have yet to find a good one, and not only me), I can store data locally and online with full search index. But there’s huge problem with PDF support. Seriously, Flash PDF support sucks.

The plan.

First, I need to research a lot more about handling the PDF issue. If I fail to find a good solution I should probably stop and spend time learning Objective-C for native OS X programming. Right now there are several possible ways to go:

  1. pdf2swf library. It comes with C source code. The easiest way is to invoke it from command line from AIR application but this is not right. I might be able to modify it a bit and compile to SWC using Alchemy. The problem is that I don’t know C and have never tried to do anything with Alchemy. pdf2swf has some issues too, especially with fonts.
  2. Port a Java PDF library. With Flash 10 it is much easier to port a Java library to AS3, there’s even a special syntax converter and there should be AS3 implementations of core Java classes. This should be much easier than rewriting from scratch. This is what PDFCase has done, but I can’t contact its author. It is a port of PDFBox Java library. I played a bit with it but am not sure still what exactly it parses PDFs to. I am getting a lot of COSObjects and don’t know what they contain and how to work with them. Also, it takes 20 seconds to parse a 60 pages PDF file with several images. So in a port there must be a way to break the whole task into small subtasks not to hang the player. And I still have to understand how PDFBox works to start porting it.
  3. Write my own PDF parser. From what I saw PDF format is complicated. And I couldn’t find a free format spec.

Another question is what to do after I parsed a PDF file to simple instructions. I need to render them with Flash. This might be a problem too, especially with fonts.

Well, if I find a solution to the problem above the rest is pretty straightforward: prototype the interface, use Flex and Swiz to code it, fix bugs.

Afterthoughts.

I think that AIR might be not the tool of choice (see the irony?) for this type of project. I might need to learn Objective-C and code this application as a native OS X app, because there are frameworks to work with PDFs for Objective-C. For example PDFKit and SkimNotes. This might take some time but I am an experienced programmer after all. How Objective-C can be so different from ActionScript? Doubt it.