To apply inverse masking in flash as3, you can achieve this by applying BlendModes.
Here is how:
1) apply flash.display.BlendMode.LAYER to the parent object
2) apply flash.display.BlendMode.ERASE to your inverse mask object
3) Awesome.
After working on a project for a while utilizing native as3 3d space, moving objects along the z axis, rotation and having the time of my life,
I realized that as soon as you try something stupid like that, every object will be blurred even if you reset their position to their original 2D positions, with no rotation, and the z position set to 0.
The designers would, of course, have none of it.
If any of you have encountered this issue and need a workaround, here is one:
1) remember your objects x/y positions
2) set your matrix3D to null (someObject.transform.matrix3D = null)
this will place your objects in your corner, so you need to
3) reset x/y on your objects. you know them from 1)
For example:
var position:Point = new Point(content.x, content.y);
content.transform.matrix3D = null;
content.x = position.x;
content.y = position.y;
I’ve been thinking about writing this post for a while, but every time i started it felt like i was trying to teach a crowd that already knows better than me, and that’s a level of arrogance beyond even me.
But i can’t help but feel there is something to how i do things that must be at the very least affirming to some developers out there. Flash developers often work alone or in small groups, and few really have a big community to hang out with. It creates an atmosphere where you are never really comfortable with your own skill level, and for me at least it fostered a belief that everybody out there were doing rocket science and I was still building Lego cars and didn’t even bother to make the colors uniform.
I’ll write down some specific beliefs that have helped me a lot.
Today we launched our super hip Christmas card generator, where you can draw a tree, decorate it, and send it to a friend.
The tree is then planted in our mysterious Christmas tree mountain world for everyone to see.
In these green times – make a virtual tree and share the love here: http://creunaclient.no/jul/
We are looking forward to seeing YOUR tree in the magical forest of virtual Christmascards.
Another quick one this. I stumbled across another one of those nostalgic particle tutorials that showed how to make a waterfall. It was really basic stuff, but inspiring nonetheless. Being a jerk, i decided to make the ultimate particle waterfall effect, what with displacement maps and diffraction and all that good stuff.
It turns out, however, that this is very boring to do.
Instead, as i was playing around with the particles and various combinations and sequences of blend modes, I started listening to my current favorite contemporary composer, Max Richter, and I wound up making this thing instead. (Beware! Music! Also, CPU murder!) Continue reading »

Just a real quick PSA to let you know that we’ve moved the RSS feeds over to feedburner.com. I believe the transfer should be seamless, but just in cased someone feel stranded, just unsubscribe and re-subscribe to fix any problems.
We apologize for any inconvenience but we’re stat-whores, so we need to satisfy our curiosity.
That’s all.
This article was cross-posted on ctrloptcmd.com; Martins personal blog.
Hear ye; Codesmiths and Script Artisans. Nay; Hear ye all who labour with keyboard and mouse, for you owe a debt to the singular person we commemorate today.
Ahem. On this day, the 10th of december, a shockingly large number of years ago the First Programmer was born. If this story isn’t old hat to you you might be surprised to learn the bearer of this distinct honorific was born in 1815 in London.
What might also surprise you, a pleasant surprise, is that she was a woman.
Ada Lovelace

Born Augusta Ada Byron she was the daughter of Lord Byron (he of poetry fame and infamy) and Anne Isabella Milbanke.
Her mother, who was not impressed with Lord Byrons debauchery and loose morals focused her education on mathematics and science, forbidding her to pursue the social sciences in order to prevent her from becoming a bohemian bum like her father. At seventeen Ada showed remarkable aptitude in mathematics and her interest continued even after her marriage; Contrary to the custom of women at the time.
Charles Babbage, her friend and fellow math wiz (amongst other things) had been working with logarithms and in an effort to remove uncertainty and human errors in this line of work he conceived of a Mechanical Computing Device to replace the traditional system of the time which were human clerks with the title ‘Computer’; “One who computes”.
Babbage; For all his genius ground work, was severely limited in his conception of the computer. He saw it as a mechanical means to execute mathematical operations with high precision. Enter our heroine Lady Lovelace.
In 1842-43 she translated a memoir of italian mathematician Luigi Menabrea on Babbages conceptual machine. Her additional notes were longer than the memoir itself, and substantially more visionary in nature. In these notes she conceived of making the analytical device accept, comprehend and execute commands; In essence creating the first programming language.
Babbage was never able to actually create his machine, and Ada never got to see the fruits of her labour. Vindicated in history her notes are published and distributed today, she has post-humously been awarded a medal from The British Computer Society and the contemporary programming language Ada is named in her honor. As a side note; Babbages machine have later been constructed as per his notes and was found to be highly accurate at mathematical operations.
Why should we care?
Geek holidays are great, and we need more of them. But if you look at the notable dates and personalities in this industry there are two factors that separate Ada Lovelace from the rest.
Firstly; she is by far one of the strongest examples of the long heritage of brilliant people on whose shoulders we stand to todays technology. Secondly: and it’s sad that this should matters, but it remains to be a factor and an important one at that; She is a woman. Our industry is heavily male-dominated. Not only in our workplaces but also in our heroes and legends.
I mean no slight to Alan Turing, Steve Wozniak, Sir Tim Berners-Lee and their esteemed co-idols, but by god; this sausage party needs some dames.
Searching for “Ada Lovelace” yields among other links a page that declares 24th of March to be Ada Lovelace Day and ask bloggers to pledge to write a post about Ada. Since the site seemed defunct after this date I propose that Ada Lovelace Day should be her birthday; the 10th of December and that we geeks make room for it among Towel Day, Blue Beanie Day and PI Day so this amazing historical figure gets the attention she deserves.
Who’s with me?
Further studies.
- The wikipedia article on Ada Lovelace from which most of this post was taken
- iTunes link for “The Enchantress of Numbers“. The episode of the great podcast “Stuff you missed in history class“.
- The difference engine; A site dedicated to the work of Charles Babbage.
I had a serious epiphany with OOP, when i was first learning it, where i realized that the real power of object oriented programming is the ability to build your own language dialect. No longer are you forced to use abstract constructs to make up your application. When i start a project, i throw down the idea as physically relatable as possible on paper, and the next step is to do the same in stub classes in the project. This translates to boxes and arrows first, and then classes with names like Image and UserInputField. There is obviously already a Bitmap class and a TextField with an input type, but when i work, to keep myself in check and not lose track of the process, it helps me mentally to think of a specific input-field type rather than an input-field variant of another type. Long story short, this boils down to taking the tools i have available and labeling them for what use i have intended, both practically and mentally.
This ability to “bend the dictionary” is the #1 reason i am in love with programming, and probably why i can stomach doing it for a living at all. Design patterns are Good Things, but overuse and attitudes bordering on religion take this flexibility and bashes it with rocks until you’re back to square one; Speaking another people’s language.
One of my pet peeves is that most regular expressions matching URLs fall somewhat short of what I expect. This pattern from John Gruber is so far the best I’ve found but, like virtually every other implementation, it doesn’t match URLs without protocol. Nobody expects to have to include “www” in a URL for it to work these days, and in daily conversations it’s rare to enunciate “aitch-tee-tee-pee-colon-slash-slash” when you refer to some website. So why is it so hard to match URLs without using these strings as crutches?
Stopp has put together a really well done Flash campaign site with remarkably solid video integration over at http://www.tackfilm.se/
So well done in fact i’m curious about how they did certain things. I’m assuming they render in motion tracking dots in the video and use those to distort the bitmap you pass in at runtime with blendmodes and using the drawTriangles method discussed in this post. We’ll have to play around with this ;-)
If you can’t read Swedish, the site asks you to provide an image of a person. The top left button lets you browse your HD, and the bottom left button grabs one from your webcam. Clicking “Använd” takes you to a zooming/framing step, before taking you to their main attraction. I’ve seen this sort of thing before, most notably at the Prototype video game campaign site, but this goes above and beyond.
Update: Color me corrected! For every seemingly complex problem there appears to be a rather simple solution, no? Anders pointed me to this presentation. Essentially, embedding motion tracking points in AfterEffects using cuepoints. I have to admit, i didn’t see this as viable, but apparently i’m just being a sceptic nincompoop about it. Tres cool stuff.
To quote him on twitter:
@UnitZeroOne: Changing the lightmaps to these, http://is.gd/4X2ub and http://is.gd/4X2vs will result in this swf; http://is.gd/4X2s7
If you’re not familiar with Flash and its limitations, let’s just say that this blows my mind to Nibiru in terms of performance and fidelity. Bloody hell.
Every so often I stumble across something that really just leaves me dumbfounded. The only valid response seems to be “… Fascinating!”
The latest is this clever JAPH consisting solely of keywords.
s x x length uc ord and print chr
ord for qw q join use sub tied qx
xor eval xor print qq q q xor int
eval lc q m cos and print chr ord
for qw y abs ne open tied hex exp
ref y m xor scalar srand print qq
q q xor int eval lc qq y sqrt cos
and print chr ord for qw x printf
each return local x y or print qq
s s and eval q s undef or oct xor
time xor ref print chr int ord lc
foreach qw y hex alarm chdir kill
exec return y s gt sin sort split
In short; The Perl community has a meme going where you are supposed to write a snippet returning the String “just another perl hacker” in the most convoluted and obfuscated way possible. This gem does exactly that. It’s beautiful in that there are no Strings, only valid Perl keywords, and it’s perfectly justified. I dunno. This kind of useless stuff really appeals to me for some reason. I fear a couple of hours may be lost to trying to create a clever JAAH.
The culmination of this 3-step drive into bitwise operators is their most common use in Flash development; Color manipulation Continue reading »
So about those 32 booleans in a single integer…
Continue reading »
Just a quick writeup of some math and number techniques that have become more and more frequent in my script. The goal is, of course, less typing and code that executes faster. Continue reading »

First, a quick introduction. What’s your name, and what do you do?
Cristobal Dabed, i’m a developer who works @creuna in the frontend team,
but it’s difficult to say exactly what i do. In short i code for food.
First, a quick introduction. What’s your name, and what do you do?
Not as skewed as it looks.
I’m Martin. I do different stuff to computers until they yield to my wishes. More specifically; I primarily do HTML/CSS/JS and ActionScript, but dabble in all sorts of other languages on the side.
Continue reading »
Here’s an old AS2 project i had that i finally ported to AS3. It’s one of those things where the effect you wind up with isn’t as mindblowingly cool as you had imagined, but i think it’s a pretty neat proof of concept and probably something that can be done a lot more with.
What on earth is going on here?
If you have a webcam, hook it up and let’s paint with time! Continue reading »
(If you don’t, turn down your volume. There’s an incredibly awesome music video as a fallback)

Yonas, the halloween ninja
First, a quick introduction. What’s your name, and what do you do?
I’m Yonas Sandbæk, and I’m a front-end developer at Creuna Oslo. I’m quite a versatile developer, with experience in many languages, but currently only working with HTML, CSS, and Javascript.




Recent comments