02
Jul
09

Flash on the Beach

We’re sending three people to FotB this year. It’s our first time at the conference and we’re going mostly due to the recommendations from friends and colleagues who’ve been there before.

Very much looking forward to great sessions with all the flash-sphere names and getting to know others who work with flash. Coincidentally, Papirfly went to Brighton this winter for three days of work on strategy and products. Due to inexpensive flights and proximity to Gatwick airport, going to Brighton ended up costing about the same as staying at a hotel in Norway. Fortunately, we blew the savings on a day of racing at the Goodwood Motor Circuit! Brighton’s a nice, friendly city that I’m looking forward to visiting again and I hope to get to know the flash community better.

See you in September.

Flasher in a classic Porsche

Flash developer in a classic Porsche at Goodwood

09
Jun
09

Work at Papirfly?

We seem to have avoided the credit crunch, there’s still too much to do for too few people. So we need more talented flash developers. Requirements are, in short, good programming skills. We do most of our development in Flex builder and AS3, some older projects are still in AS2. Knowledge of printing processes is a plus, but not a requirement: CMYK colours, ICC profiles, Type1 vs. TTF vs. OT, etc.

You must be willing to relocate – F2F is still better than IM. And willing to learn to speak Norwegian (or do so already).

We’re located in Sandnes, just outside Stavanger – Norway’s third largest and most beautiful city. We offer good insurance plans, a company cabin, really, really nice colleagues, interesting work and excellent coffee.

Take a look at the company web page for more about us. www.papirfly.com or www.papirfly.no. Contact us at perATpapirflyDOTno (you know how to decode the email address)

02
Jun
09

DIY Flex SDK 3.3 in Flex Builder

Adobe has updated the flex SDK to 3.3 – they did so in March this year. I had assumed that this update was part of the Adobe auto updating regime – all other Adobe applications are handled, but apparently not all parts of the Flex Builder. So instead of waiting for things to fix themselves, I did it manually using these clear and simple instructions.

I was playing around with the Flex 4 betas when I saw it. Installing the Flex 4 SDK follows the same steps, but using it is a roller-coaster of weird bugs and exiting new features. I’m currently trying to get to terms with the new Text Layout Framework API. Exploring new APIs is overwhelming, but I have to say that it looks very good indeed.

28
May
09

Open challenge: Dynamic ContextMenu

Inspired by the very enjoyable challenge from my friends at Apt, we’re doing our own. In a recent project I needed a contextMenu which allowed the user to select the number of pictures to show in a ad template. The choices change with the size of the ad, so every time the context menu is shown, it’s regenerated first. But for the challenge, you can skip the regenereation bit.

I’ll post my solution on tuesday (2.jun)

Continue reading ‘Open challenge: Dynamic ContextMenu’

19
May
09

Modulo (%) – the designer’s best friend

I became a programmer because I was a lazy designer. That is lazy as in “Why create fifty animations that are almost the same”, not “bah – good enough, customer isn’t going to care”. I want top results with as little effort as possible. So actionscript was the way to cut down on unwieldy timelines.

The downside of not having a programming degree is that a few of the useful concepts and methods remain obscured in a corner. As with modulo. For those of you with a maths degree, just skip down a few paragraphs. Designers – bear with me.

Modulo is a maths operator like multiply and divide are. It is most similar to divide as it returns the remainder from an integer division. Quick example: 13 % 10 = 3 because 13 can be divided once by 10 with three remaining. 23 % 10 is also three as 23 can be divided twice by 10 with three remaining.

So why should I care, the designer asks, this is all very interesting, but what practical value does it have? One scenario is my contribution to this mini challenge from Apt, although SIN is probably better in that case. I’ve used it most when laying out n-objects in a grid to calculate x-position. As % returns the remainder, you can multiply count and x-step and do a modulo on total width.

An example:

function placeItems():void {
  var numItems:int=45;
  var xstep:int=15;
  var ystep:int=15;
  var totalWidth:int=150;
  var item:MovieClip;
  for (var i:int = 0; i<numItems; i++) {
    item=createAnItem();
    item.x = (i*xstep)%totalWidth;
    item.y = Math.floor((i*xstep)/totalWidth)*ystep;
  }
}

placeItems();

function createAnItem():MovieClip {
  var item:MovieClip = new myItem();
  addChild(item);
  return item;
}

Which results in this if you have a blue square in the library exported to actionscript as ‘myItem’

modulotest

All the magic is in the last two lines of the for…next loop, it places items in a grid without needing help counters.
Look at item.x = (i*xstep)%totalWidth. It multiplies item count with distance between items and does a modulo on total width. I.e., if i*step is 330, 330%150 = 30. Combined with stepping y down with whole multiplies, we get a nice grid. Y value – if i*step is 330, it gives  2.2 when divided by total width, lose the decimal and we know it in row 2.

It’s super easy to change parameters. Set x/y-step or total width and you’re done. Just keep total width divisible by x-step, else the gird gets staggered.

Anyone else with good examples of modulo for layout?

20
Apr
09

Server result, who called?

I ran into a problem the other day. We integrate our flash application with a server-side image archive, allowing browsing from the flash front-end. That means loading a tree structure and contents of all folders. We only load the structure initially to optimize bandwidth usage – data about the contents of folder is loaded when the user selects a folder. That means the first time I select a folder for this session, a call to the server is made requesting the content of that folder. A call-back function is set which handles placing the data into the dataProvider and updating the view.

So far, so good. But there was a snag – to further optimise transferred data, we only return data about the images in the folder, not what folder they are in. So the call back function has no way of telling where to put the data unless we make sure that there’s only one call for folder contents at a time. Continue reading ‘Server result, who called?’

27
Mar
09

Easy tweaking of Flex component skins

We run a dark grey theme for our Print application. This has required quite a lot of tweaking to get it right and despite using the css way of configuring and skinning all components, Adobe did not have dark palettes in mind when they designed the Halo theme.

printuiexample

E.g.: to get the selected and rollover color right for lists, we had to extend and hack the Activator class because default color handling mixes the theme color with white to get the different shades needed. Which look quite odd in a dark theme. Continue reading ‘Easy tweaking of Flex component skins’

11
Mar
09

Program manager

Joel Spolsky of Fog Creek software has posted an interesting article: http://www.joelonsoftware.com/items/2009/03/09.html

Reading it was one of those “ah! I knew that” moments – where you’ve experienced something, but haven’t really put it into words.

The gist of the article is that a programming project needs someone who doesn’t write code to ensure that the end users needs aren’t forgotten. And that is really important because the person responsible for coding the project will almost inevitably focus on solving code problems, sacrificing end-user needs. I know that I do that myself. If I’m in charge of delivering code, that’s the focus; if I’m in charge of the design, end user needs are at the forefront. Continue reading ‘Program manager’

05
Mar
09

ErrorEvent – equivalent to throw new Error?

A technical question for you out there:

I had a class that dispatched an ErrorEvent which was not listened for by any other class. That resulted in the player popping up an error dialogue very similar to the one you get from throwing Errors – and not catching them.

Nice image – imagine a juggler throwing three or four Errors into the air and catching some of them.

The documentation for ErrorEvents says that ErrorEvents without listeners will be displayed by the debugger, but I can’t quite see how it’s handled. ErrorEvent inherits TextEvent, nothing special there. I just wonder how the flashPlayer detects these events. Is there hard coded special handling of Errors? Or are there attributes of the ErrorEvent that tells the player to treat it differently from other events?

File under “unecessary fidling with the API”

24
Feb
09

Flex “Workspace in use…” error – arg!

Most annoying thing about Flex Builder. If I work for a while in Flex, then quit and try to start Flex again it says “Workspace in use or cannot be created, blah blah”.

I can then either restart the pc  or use task manager to quit process “Javaw”.  I’m running FB 3.2 on Win XP (all patches and service packs thank you). It’s not a huge hassle to quit that process, it just seems like an unnecessary bug in a 3 point 2 version of a major application.

Has anyone found a workaround or perhaps knows what the cause is? A search showed that I’m not the only one annoyed by it, but there doesn’t seem to be a fix yet.