Archive for the ‘Announcements’ Category

AS3Wrapper: Pulling Flash objects into Javascript

Monday, May 26th, 2008

I’m very excited about a new tool that I’ve written this weekend called AS3Wrapper. It’s a Javascript library, compatible with IE and Firefox, that can pull the contents of the Flash virtual machine into Javascript.

The result is that the entire Flash API becomes accessible from regular script tags. Owing to the simlarities between the two languages, coding Flash in Javascript is actually incredibly natural, and what’s more, it also seems to have pretty nice performance!

A Simple Example

Here’s a simple example at work. I suggest you take a look at the source code to see how the Javascript is constructed.

You first have to create yourself a Flash player object:

var player = new
  AS3Wrapper.Player("content",100,100,false);

This replaces the div in your html page with id ‘content’ to be a 100×100 Flash player instance. The false parameter prevents transparency. The player might take a few moments to load, so assign a callback to setup your Flash scene:

player.onload = function(){
  // Do the meat of your Flash work here
}

Once the player has loaded, it’s javascript object will contain the complete class hierarchy of the internal Flash API. For example, player.flash.display.Sprite will be the constructor for the flash class flash.display.Sprite inside player ‘player’. Here’s a screenshot from Firebug:

To write Javascript for a particular player, use with. With blocks are also the equivalent of the ActionScript import statements. Apart from this, there is pretty much a direct correspondance between the two languages. For example:

with(playerInstance)
with(flash.display)
with(flash.net){
	var image = new Loader();
	image.load(new URLRequest(url));
	addChild(image);
}

is the Javascript equivalent of

import flash.display.*;
import flash.net.*;
... {
	var image:Loader = new Loader();
	image.load(new URLRequest(url));
	addChild(image);
}

Pretty similar, huh?

Some things to note: Javascript doesn’t have type annotations (obviously), and because IE doesn’t support getters and setters, I’ve created methods instead - getWidth() for getting a Flash ‘width’ property and setWidth(v) for setting it.

What next?

One impact of this might be that it opens up Flash programming to a wider audience. Even though Flash compilers are free, having the code right there in HTML eliminates the extra step of installing extra tools. What’s more, any code generated in this way is naturally open.

By using the Papervision3d module (see this example), you can now program quick-rendered 3d in Javascript. You can also use a Javascript console for interactive Flash programming and debugging. Maybe one day Flash grease-monkey scripts will exist? Who knows.

There are, of course, also many disadvantages: losing a richer programming environment, type checking and performance. But still, hopefully you’ll find playing with it a little bit of fun!

Download

You can download AS3Wrapper here.

Announcing The Effect Generator!

Sunday, February 24th, 2008

I’ve spent the last few weeks feverishly working away on my latest website, and today it is my great pleasure to invite you to try out my new creation, effectgenerator.com. The Effect Generator is whole new way of creating Flash content online for free, within a simple but powerful what-you-see-is-what-you-get drag-and-drop graphical editing environment.

Unlike most online Flash generators, which normally configure a limited range of template effects, The Effect Generator lets you select from whole multitudes of transitions, layouts, animations and public media, so your imagination is the only limit. The site also contains a moderately-sized template library, which, aside from illustrating the power of the effect building system, also lets you rapidly configure stock effects. Once created, effects can be rapidly posted to blogs, social networks, or any custom HTML page.

Here are some example effects created with The Effect Generator:

Example 1 - Example 2 - Example 3 - Example 4

Getting Started

To try out The Effect Generator, click here. Here’s a quick 3 minute walk-through screen-cast:

Video text

Hello, welcome to effectgenerator.com - a quick way to author and publish stunning animated graphics online!

On the left-hand side of the screen, you will see a library of components. To add a component, simply click on the component and then it will be displayed in the preview pane on the top-right. In the preview pane you can drag components, rotate them and resize them as you see fit.

On the bottom-right of the screen you will see a configuration panel, where you can change, for example, the colour of the text you are dealing with, or select between a wide range of fonts.

As well as text, you can add images, either by selecting a URL, or by uploading an image directly from your computer. Likewise, these images can be dragged and resized within the preview pane itself.

There’s a library of transitions and animations, filed on the left-hand side under ‘Animations’, which can be applied to any components within the canvas. For example, if you select our text, select ‘Display Transitions’ and select ‘Scale Up, then the text will appear to grow when it is displayed. Similarly, you could add a Blur effect, and a Rotation effect. To the image, we might add a Shine effect.

Other simple components you might like to use include various simple shapes. We can add a Star to our text, and set it to fade in on display. Each transition animation can be set to last for a given length of time, as well as to occur between a given range of values.

Once your effect is complete, you can click on ‘Publish’, provide optional details about the effect, and then you will be presented with a URL that displays your effect, a URL for editing your effect, and a whole range of different plugins to post to different blogs or social networks.

The Effect Generator also comes with a range of templates that can be easily edited. For example, there are various different slideshows that can be configured individually with images uploaded from your PC, as well as a variety of different text effects. Each of these templates can either be opened directly, or added as new component in your existing canvas.

We hope you enjoy using The Effect Generator.

Technical Information

For the technically minded, The Effect Generator project is based around a new intuitive XML-embedded domain specific language for generating special effects graphic and layouts, called FXML. You can think of this as being a bit like HTML for Flash, only with the potential for much greater scalability and pluggable motion graphics effects. The most exciting features of FXML are its capacity for compositionality of stop-motion effects, and for generation via dynamic server-side scripting environments. The FXML player is a slimline flash movie (only 30k) that plays effects written in FXML code. The Effect Generator is a graphical Rich Internet Application for editing FXML, itself created in Flash.