Archive for the ‘ action script ’ Category

SWX PHP – takes only 3 minutes to set up

I am working on a new project that requires serverside development, using Apache, MySQL and PHP. However I didn’t want to change my current personal webserver configuration – the one that comes with OS X, and I remembered my friend Eran’s tip about MAMP – an independent standalone webserver, but never got to download it.Then, few days later, Aral released SWX PHP 1.0 (remember SWX?), and offers a very convenient way to start playing with SWX in minutes, using no other that a MAMP bundle, already configured with a useful Start Page linking to the SWX Service Explorer & Data Analyzer , can’t be simpler than that.. try it out!Great work Aral! I liked the Screencast explaining how to set it up, Aral simply explode you with knowledge : )
swx.jpg
I also find the SWX icon very amusing in my dock..

FIVe3D – a new Flash ActionScript 3D package

five3d.jpg
A new open source vector based 3D animation engine for ActionScript called FIVe3D has recently been shared by Mathieu Badimon. Thanks Mathieu!It is a ActionScript 2 classes package, enabling 3D rotation and position control over objects such as movieclips and text fields.For setting up a simple 3D environment, with simple objects and basic interactivity it is indeed fast and pretty simple, as described by the author. I am sure in few months it will pick up some more advanced functionalities, we should be proud that such exiting initiatives are emerging in the open source sphere.I was impressed by the thorough (and beautiful..) documentation he provides with the source code, neatly packed in a pdf file. that’s the way!

Learning someone else’s code – what is it good for?

actionscript.jpg
From time to time I get to work on someone else’s code, could be shared classes I download or a client that brings his own program for treatments, anyway it is something that nobody likes.The difficulties are obvious to anyone that deals with code this way or another, (hey, sometimes I have hard time understanding my own code from six months ago..) But there are also great advantages if you’re trying to improve, although the learning curve is often steep, it’s faster than learning from books.Sometimes, definitely not most of them, it can even lead to a real leap, in term of understanding new styles and patterns, I never stop learning new things : )At larger scales, translating ActionScript classes into UML would be a blast, making sense in a glimpse and not through lines of code.And an answer to this need (and more!) is about to be born – Saffron UML by Samuel Agesilas, built for AIR, has a cool UI design, and platform independent – you have to see it!Looks amazing ha?

Flash – Highlighting a string in a textfield

Jack Doyle at greensock shared a really cool AS2 class he calls ‘TextMetrics’ – sounds promising ha?The class calculates x/y coordinates of a string in a textfield, allowing highlighting it or calculating rows width.. nice.Check out his example. Thanks Jack!

Started using Eclipse for ActionScript, not leaving Flash yet

During the last couple of months I’ve been doing some heavy flash work for ICQ (that instant messaging thing), great guys there.Anyway, part of the project required generating SWF files on a server, compiled using MTASC, an open source ActionScript compiler. I decided to grab the opportunity and start using Eclipse (an open source development platform) for editing ActionScript on my Mac (instead of TextWrangler), and compile with MTASC without the help of Flash IDE.It is easily done using the Flashout plugin. a great tutorial found here, it works the same on Macs, as Eclipse is platform independent.Well, so far I am a bit disappointed, compiling is faster but using ASDT for editing the AS code is not that good, it is not so up to date with features… hope a new release is coming soon.In meantime, I still want Flash and TextWrangler available.Speaking of ASDT, can someone please explain why my ‘Refactor’ menu is disabled?!

Communicating with Flash – External Interface method

Be warned, I will discuss ActionScript in the following words, you may want to eat something before reading any further. Any way, this may not be “hot news” but will still open my ActionScript category :) From time to time when I have more than one flash site open and they play sounds or music, I get confused which window produce what music? Since I am using a Mac where all the windows sounds just blend, it is really hard to tell.I expect flash authors & developers to handle this issue, especially in flash website, by adding a script that will stop the sound in the flash when the window is loosing focus. This is an example of a need for communication between flash and the scripting environment, invoking JavaScript functions from flash and vice versa, actually it’s also relevant in applications embedding flash player, and maybe Apollo soon?.
I will start with legacy methods:
The good old Flash Methods is pretty simple but very limited, all it can do is set/get a property in the flash object, or send flash few basic commands. The other direction – invoking JS functions from within Flash was done using fscommand that can pass one argument, so by using some kind of formatting (heard of Jason?) enabled passing few values in one string. However, fscommand does not return any value to flash, and therefore required using listeners for utilizing in more complex applications.
The new method:The External Interface Class Is a more matured method for communicating between ActionScript and the environment, available for flash version 8 and above, all major browsers.

From ActionScript, you can do the following on the HTML page:
Call any JavaScript function, Pass any number of arguments, Pass various data types (Boolean, Number, String, and so on), Receive a return value from the JavaScript function.
From JavaScript on the HTML page, you can:
Call an ActionScript function, Pass arguments using standard function call notation, Return a value to the JavaScript function.

It works by registering a function for external use by the browser, the registration is done using the ExternalInterface class and basically dedicates a unique name for each function.
This example shows an event (Page loosing/getting focus) that triggers a function in flash (stop/play sound), you can download sources here.