I spent most of today fighting this incredible bug and it nearly got me. At some point I even admitted defeat, which I never usually do. But while trying to circumvent the said bug, I found its Achilles’ heel and nailed it. It tried to bring me with it to the other side by grabbing [...]
Dear community, I’m pleased to introduce a new Spring extension called Spring ActionScript. This extension, formerly known as the Prana Framework, is aimed at bringing Inversion of Control to ActionScript along with several other interesting utilities. The extension is written in ActionScript 3 and is targeted at Flex, AIR and Flash developers. The IoC container and [...]
This second part of a three-article series reviews KapInspect features in detail. KapInspect Basic Principles The left pane displays a tree of the display list for your application, and for popups if any. For popups, you must refresh manually with ‘refresh popups’ button. When you select an item in the display list, a frame will outline the component selected [...]
This is the first in a three-article series on KapInspect. What is KapInspect? KapInspect is a free debugging and introspection tool that will help Flex and AS3 developers to inspect their applications at runtime. Its main features are: Display list hierarchical browsing for applications as well as for popups Dynamic display list tree, reacting to add and remove children on your [...]
A month ago (October 15th 2008) was the release of Flash player 10, but it was also the week that my second rich internet application was set (a)live. I wanted to make a post about it for a long time but I had a lot going on and only just now have things slowed down. [...]
I haven’t done anything with ColdFusion in a long time, but I may need to reconsider it as a middle ware between my Flash/Flex/AIR client applications and the database. Adobe released the ColdFusion 9 beta (Centaur) at MAX and one of the features that caught my eye was the object-relationship mapping. This will [...]

Finally I had a bit of time to go back to the discussion I started about a month ago: scripting your flash applications. I spent a bit of time thinking which is the best approach to start discussing this kind of topic; it is not as easy as it seems because the risk is to fall into a too complex discussion that a lot of people won't benefit from.

So I decided to start with a simple example that is somehow related to what I'm doing in these months; more examples will come and I'll analyze different aspects of scripting trying always to keep the discussion as simple as possible even if this may bring me to do avoid some hard to discuss approaches or optimizations.

Our first scripting language will be an extremely simple language that will be used to manipulate images (like Pixel Bender does). Obviously the goal is not to write something that can be compared with Pixel Bender, but at least we would like to provide an implementation that will lead to scripts as fast as native code (at least we hope so :P).

The first step is to design the language, and to do that we need to do the step zero that is to define the goals we want to achive with the first implementation:

  • The language must be extremely simple to design and implement (it is a didactic stuff indeed!);
  • The language must be as simple as possible to learn and use: we won't be an alternative to Pixel Bender (because we can't ... yet ;P)
  • The language must be quick to compile and execute.
  • A script must accept some parmeters to control its behaviour.
  • We must support comments!

Now that we decided which are the goals, let's start definign some limitation or features we must include to quickly reach a solution:

  • The first implementation of the language will support a sigle data type: Numbers. We will move further adding more data types later - I don't want to focus on type checking yet.
  • We will add support for basic expression operators, basic control flow. No support for functions yet.
  • The language will provide some useful operators or builtin functions to manage common operations like packing/unpacking color components and peform some mathematical operations.
  • Arguments to a script will be only Numbers at first.
  • A script will be defined as a simple sequence of arguments followed by a function definition. This function will be applied sequentially to every pixel of one or more source images.
  • We will provide to implementations for the language: a simple (and slow) interpreter at first, then we will generate native SWF code to speedup the performances.

Even if briefly, it is quite important to define the goals of our language and then the features, because a lack of design (even if extremely simple and poor as the current one :P) may lead to unexpected issues during implementation.

Now that we defined those basic pointers, let's see how the language will look like:

// Simple crossfade filter

// The crossfade intensity
argument intensity;

/**
 * A quick explanation of the used builtins:
 *  - in( id, x, y ): gets the ARGB color at x and y of the image identified by id (there can be more than one image as input);
 *  - out( id, x, y, color ): sets the ARGB color at x and y for the output image identified by id;
 *  - argb( a, r, b, b ): build an ARGB color from its components (clamping and rounding the values as required);
 */
evaluatePixel( x, y )
{
  // this kind of assignment is similar to the python unpack assignment
  // but extracts the 4 components (ARGB) from a color.
  a1, r1, g1, b1 = in( 0, x, y );
  a2, r2, g2, b2 = in( 1, x, y );
  
  out( 0, x, y, argb(
    ( 1 - intensity ) * a1 + intensity * a2,
    ( 1 - intensity ) * r1 + intensity * r2,
    ( 1 - intensity ) * g1 + intensity * g2,
    ( 1 - intensity ) * b1 + intensity * b2 ));
}

As a side not, I must say that the language may change during implementation because of unexpected limitations we will find during development.

Next week we will move forward start implementing the language. Stay tuned!

As I said the other day, the current cacheAsBitmap behavior has a few drawbacks which makes it nearly unuseful. As you know, the biggest problem of cacheAsBitmap is that the cached bitmap gets updated in memory everytime you modify it. In fact, only a translation on x and y axis does not update the cached [...]
Adobe announced the Cocomo beta at MAx last week. This is a service hosted by acrobat.com that allows developers to add real-time social capabilities to their applications. Cocomo also has Flex components that should make building these social applications really easy. You can sign up for the beta on labs. Once I get [...]
Last night I approved the cover copy proof and sent that back. That’s pretty much the end. It’s off to the printer in a few days and should appear on the shelves some number of weeks later. Not sure the exact date. Amazon says December 29, but they’ve been known to flip flop. http://www.amazon.com/AdvancED-ActionScript-3-0-Animation-Advanced/dp/1430216085/ref=pd_bbs_sr_1?ie=UTF8&s=books&qid=1227626751&sr=8-1 Anyway, doesn’t look [...]
Calling out for some support for my co-worker Thomas Joos who has created a Rock Werchter Mobile Guide. If you have a minute, be sure to give him your vote! Congrats Thomas! Quoting Thomas: “Last week I received an email from Adobe bringing me the wonderful news that our Rock Werchter Mobile Guide was selected as [...]
Not to be confused with Object Pooling, I’m referring to saving data you need to persist in your application across sessions, and more specifically about saving images in your own local cache as opposed to the browser cache. As usual, I ask a question on Flex coders and get no response. This usually arises from [...]
Probably one of the biggest things to happen to Flash….maybe ever. Last year at MAX Adobe gave us a sneak peak at a research project that took C++ code and compiled it into ActionScript. The demo they showed at the sneak peak at MAX 2007 of Quake running inside Flash Player. This [...]
Last week I had to write a small piece of code to send to a webservice a number from a text input. All was fine for the normal test values (0,1,100). The problem appeared when I tried to send the number -9223372036854775808. Instead of receiving this number I got -9223372036854776000.  So I started to do [...]
What can you do in 25 lines of code? Who have the telnet to code admazing flash in 25 lines, let come and join the contest. Here are the rules,  judges and prizes. The contest begins at 12:00:01 a.m. morning EST (GMT - 5). Check it out.    Tagged: Actionscript, contest   
What can you do in 25 lines of code? Who have the telnet to code admazing flash in 25 lines, let come and join the contest. Here are the rules,  judges and prizes. The contest begins at 12:00:01 a.m. morning EST (GMT - 5). Check it out.    Tagged: Actionscript, contest   
We have rules. We have judges. We have prizes. Now we need code. The contest begins at 12:00:01 a.m. tomorrow morning EST (GMT - 5). Check it out.
In the comments of this post, Emanuele Cipolloni put forth the idea that Flash 10 3D is simply done behind the scenes using drawTriangles. That was a interesting realization for me. Made sense, so I decided to test it out. Basically, how would I create a 3D engine like Flash 10 3D using drawTriangles? 1. I'd [...]
One more problem you might run into with Flash 10 3D is when you rotate a display object in 3D. Display objects are perfect planes, which means they don’t have any thickness. The old joke, “he’s so thin that if he turns sideways you can’t see him” can be taken literally when dealing with display [...]
I've done tons of 3D in ActionScript over the years. I wrote 3 chapters about 3D in Making Things Move. I could code that kind of simple 3D in my sleep. When I say 3D, I'm not talking about the insane light map, bump map, texture map insanity that the likes of Andy Zupko and [...]

Subscribe to Planet Flash

Search

Tags

<head> 3d 3d Flash Actionscript actionscript 3 ActionScript 3.0 Adobe Adobe Air Adobe AIR (Apollo) Adobe Flash Adobe Flex AdobeMAX08 AIR AIR Adobe Integrated Runtime Announcements apollo Art AS2 as3 Asides awards Babble BEA Beautiful Web Books Business Cairngorm ColdFusion Community Components Conference Conferences degrafa design dev Development Events Examples Featured Flash Flash CS3 Flash experiments flash player Flex Flex 3 Flex Builder Flex Builder Development Flex Example FMS Fun Gallery General GeoWeb Google Industry Inspiration iphone Jobs Links linux Marketing MAX MAX 2007 Misc News news & events Off topic Open Source Other Papervision3D Parallax Denigrate Personal photos Photoshop Process Processing Resources RIA Singularity Site News Stuff techmology Technology Tennis Thinking Loud Tips Uncategorized Video Whatever

Blogs

Buttons

Planetarium