AAA (Adobe Attacks Again) and bugs

CS5, which we could as well call C$5 or C$$. I will take a look to the trials, but I don’t think I will find something interesting for me. I didn’t with CS4.

I’m so much concerned with the performance of the free Flash Player plugin that I’m not interested at all with any new products concerning IDEs, while they support ActionScript 3 (which means CS3).

Now, after years working fine, seems I can’t input my own language’s characters in a Flash text field. I can’t type “cáspita” in Safari or Chrome. Which is a dramatic issue. Now our users can’t play anymore the “Game of Wishes”, where everyone can (could) type their wishes. Not, unless they use plain ASCII in their native language or we rotate 180º and use a different programming language (!).

Also, seems there is some issue with layers (DIV) and Flash, as many sites stopped working fine in both Safari and Chrome (not to mention other browsers with less impact), including King of Kungfu (Facebook) and even Adobe’s own site.

While this isn’t solved (I hope it will), we won’t consider taking a look to CS5, not to talk about the previous CS4.

Certain issues (every app and platform has its own issues) affect so much one’s daily work that, being an old-time believer, you may consider certain alternatives which are doing their own way, such as Silverlight. It’s not that you love one or another. It’s just matters of daily tasks and production. I can’t spend months for Adobe to restore Unicode support or wmode in certain browsers (a long reported issue and still active!), as well as my customers won’t wait for me.

Flash bitmap filters (ie: DisplacementMapFilter, perlinNoise) and CPU usage

I was looking for a way to animate water in qilania (our virtual world) and I found some quick code using the DisplacementMapFilter and perlinNoise, which seems very realistic for our traditional way to animate stuff (more like cartoons), but is a quick and acceptable hack which can actually fit with our design and will save some time to the illustrator in chief.

But seems that kind of scripted animation (should say more “effect” than animation) consumes so much CPU, specially in the SmartFox/OpenSpace environment which uses to be 30fps by default.

After some researching and looking for alternative methods, we decided the fractal noise was looking so nice after all, but we needed some way to save some CPU and RAM for the end user, specially looking towards old machines and architectures. And we found a way to decrease it. This is a very simple tip: decreasing the frame rate. We did it this way (follows pseudo-code):

this.addEventListener(Event.ENTER_FRAME, go);
var nvar:int = 0;
function go(evt:Event):void {
	nvar++;
	if(nvar%3==0){
		// perlinNoise stuff...
	}
}

This way we reduced the filter to 1/3 (that is 10fps for a 30fps project), which saves more than 50% of the CPU at execution time.

It’s still so much, but minimum enough and, after all, we don’t have water in all our maps!

Hope this simple idea can help someone in a future: the simple, the better 😉

Flash against the world

Although I use to make a living from Flash since Flash 4 (learning time) and Flash 5 (real usage time, when AS 1 was born), I’ve never been in the mood to write about the goods and chimes of Flash, as most of times I’ve been forced to agree with the general sense which said that stuff made-in-Flash was crap. Who doesn’t hate Flash intros and banners and nonsensycal fireworks?

Today, in the mature age of Flash (and maybe myself’s professional mature age), I see the cake quite different.

  1. Flash is a plugin, just like the old Java plugin, QuickTime, Windows Media Player or VRML: a way to introduce rich content in a browser.
  2. Nobody demands for a plugin a bunch of features regarding navigability (integration with common browser’s features, such as history, bookmarking or accessibility), except for the Flash plugin.
  3. People in Macromedia (then) and Adobe (now) made a great effort of creativity and enthusiasm in order to introduce in the Flash plugin lots of features, including support for audio, video and 3D. Do you remember when you was forced to install a bunch of things only to hear audio in the mp3 format? Flash supported it. Do you remember when watching a video in the web was sort of chance if you had the codec installed, if available at all for your machine specs? Flash made possible a successful website such as Youtube. Do you remember when people needed something else, from the programming point of view, and AS 2 was born (and yet more AS 3), being a real alternative to today’s so called Web 2.0 and smelly things such as Ajax, which is today a very common technology?
  4. Flash, even being a plugin, offered a bridge to the user’s surfing experience from the beginnings. Wheter you like it or not, being more or less difficult for the developer, you can bookmark a page from Flash contents, access the history, make a Flash movie fully accessible and localizable, make practice of asynchronous communication with the server, get your contents indexed by major search engines and a long catalogue of things you would never expect from a plugin.
  5. Most probably, people who feels anger against Flash, feels anger as well against bad (or low-cost, if you prefer so) web developers. Me and my team can make a full blown rich app driven by Flash -in the client side- in a few days, supporting navigability, accessibility AAA and advanced features (such as databases in the backend). Today, 2010, you are told to make a website with A/V support. You have three days to make it live. Will you rely on WM, QT or Real? Or you will stick with the de-facto standard, codenamed Flash? What about 3D? Do you prefer Flash via Swift 3D, for example, or you will force your users to install whatever plugin?
  6. Bad and low-cost developers still can offer with Flash to their bad and low-cost customers much more than they can offer with their bad and low-cost web knowledge.
  7. Although Flash still offers usually much more features than other plugins (I won’t say “similar plugins”, as I don’t know similar ones), including a brand new OOP programming interface with AS 3 and integration with most if not all of modern technologies, along with the mentioned A/V capabilities, as well as support for 3D, bitmap and vector graphics, camera and micro input, etc… Although Flash offers more and still more, it still offers more again: Flash was exiled from major mobile platforms (specially iPhone, which is a point of reference), but Flash keeps trying and trying. The new betas, with an eye put over the mobile platforms, are performing so fine in the desktop in the first optimization. I believe they’ll keep improving. Stuff in the computer uses to require more and more resources (RAM, CPU, etc.). That’s because we all are forced to replace our computers, mobile phones (and now also TVs —in Spain, at least— with digital TV). And now Flash is in the business of downsampling: more features, less resources. It was time, anyway, and now begun the race. They’ll keep improving. Once more again, we demand from Flash a very high level of performance and optimization we don’t in fact demand to the own machines (nobody seems to blame Apple for creating a 4 GB iPhone or iPod, then very soon the 8GB one, then 16, 32GB, etc., making every new release feel oldies the previous ones). Adobe is making his homework in order to optimize CPU and RAM usage, support multitouch and a very long etcetera in the chain of the —oftenly stupid— needs of the market.
  8. SWF specs are free. We have now many tools —paid and free— to create and compile Flash movies. If you are freak enough, you can even create your own swf-based format and your swf-based flash player. In fact, they DO exist. You can even use your Flash knowledge to create robust cross-platform desktop apps based on SWF (Adobe’s AIR wasn’t the first to make it real, others did it first, creating environments similar to the RealBASIC or Revolution IDE’s and runtimes, such as mProjector, Zinc or the open-source HippoHX… And much more).
  9. Still waiting for others’ answers: universal, cross-platform, localizable, accessible, extensible and with the unlimited level of support of a huge and still-growing community of developers. And, as stated, with the enthusiasm required to make something new every day.
  10. Finally, the market rules. In my personal and tiny market, I never thought I was forced to learn AS 3, coming from AS 1 and 2, as well as I never thought the print shop would never accept as input a 5MB PDF document, instead of a Quark 3 document with a bunch of fonts and images enclosed in a ZIP disk. Today we have market for Flash, as well as yesterday, and a brighting future for the “newborn” AS 3 language, along with all the daily newcome features for us developers and end-users.

WindowSWF, mix ActionScript and JSFL for automation and productivity

It’s a long title for a post which could, in fact, be the only message without extra ellaboration. But I’ll ellaborate a bit, because I think this is a underrated feature I love in Flash, which allows to the end-user a full experience of automation and high detail customization of the Flash IDE. This post is for those of you who don’t know about it.

You can create a UI in Flash/ActionScript, link it with JSFL (Javascript Flash, a javascript-based language to drive the Flash IDE) and create your own utilities panel with customized solutions for your daily work. Such as this:

windowswf

I use every day the buttons in this panel. The first button in the top-left corner, for example, will convert selected items in the stage to named movie clips. It’s a silly task, but some times, before I worked out this solution, I was forced to do it manually hundreds of times in a single day (!) –> select, F8, insert name for symbol, insert name for instance in the stage.

My most impressive automation task was one responsible of arranging, making certains changes and publishing thousands of FLA files in a row, which reduced various workdays to 20 or 30 minutes I could spend in a delicious capuccino while the machine was working by itself.

This isn’t a guide, so I’ll describe briefly the mechanism:

1. You have some need (usually automation of repetitive tasks in the Flash IDE).
2. You write a JSFL command in order to replicate what you use to do manually –> most of times *any* task can be duplicated via JSFL. If you don’t believe it, create a new document, make a rectangle, group it, then go to the menu Window > Other Panels > History. Everything listed in there is pure JSFL recorded which you can copy to the clipboard. More complex tasks will require heavy tweaks, though 😉
3. You create a FLA file with a button (or buttons, progress bars or whatever) linking to the JSFL command. Usually, JSFL commands are stored in the “Commands” folder of Flash’ main configuration dir and can be accesed as well from the Commands menu. You can even assign them a shortcut. But sometimes you run out of shortcuts or you can’t remember more shortcuts (!). This is the time when you need to create your own toolbar with that bunch of customized daily tasks. You call the JSFL command from ActionScript as follow:

myButton.onRelease=function(){
	MMExecute('fl.runScript(fl.configURI + "Commands/selec-to-movies.jsfl");');
}

This example is using AS 2 syntax, but that isn’t a problem, very simple to port it to AS 3. Basically, you call the ActionScript method of the same name, which executes JSFL code. This method is *only* available to “WindowSWF” panels, XMLtoUI dialogs (created on the fly usually by JSFL commands, that is another topic) or UI components. Obviously, no sense out of the Adobe Flash IDE.
4. Move the resulting SWF file to the WindowSWF folder of the config folder (next to Commands, Components, etc.).
5. Relaunch Flash. Now you can access your brand new panel from the menu Window > Other Panels, and it will behave just like any other utilities panel (more or less, you will learn some tiny details when you do it real).

And that’s all. Even if you don’t write your own JSFL solutions, you can still create a WindowSWF panel and link it to others’ JSFL commands you can find in Adobe’s Exchange web site.

Flash movie overlapping other layers fix

Some times, you need something to overlap (that is, display over) a Flash movie, and seems Flash doesn’t like that. By default. But you can use the parameter “wmode” to change this float-above-all behaviour (which, BTW, doesn’t show the same in all the browsers). The default “wmode”, if not specified, is window. We want it to be opaque or transparent (if transparent, the flash movie won’t have a solid background and you will see whatever is below the flash movie). Of course, the layer which will overlap the Flash movie, must be in a z-index higher than the own Flash movie.

I know this is easy, but there are lots of controversial in the web regarding this topic, so I thought I should clarify it, and also keep this info in this blog for future self-consumption.

This article explains it all in detail and includes examples for all “wmode”s: http://www.communitymx.com/content/article.cfm?cid=e5141

FLA to PNG via AppleScript plus JSFL

We use this as a droplet, so we can convert dropped FLA files to PNG in a shot. The original script is much larger, as PNG files are post-processed before using them (need some tweaks in GraphicConverter or a similar apple-scriptable app), but it is a skeleton you can use in many little automation projects involving the wonderful world of AppleScript and Flash Javascript (aka JSFL), the language used to automate and extend the Flash IDE capabilities.

AppleScript --> FLA to PNG

AppleScript --> FLA to PNG (click to enlarge)

The FLA file will be exported as PNG using the last settings you used to export a PNG file.

You can download it here.

Hello world!

Welcome to my personal blog about Qilania, the educational MMORPG for kids which will be born in 2010, where I act as product manager.

This will be a very interesting project, not only for its nature, but for the great amount of technologies used in it: SmartFox Pro Server and OpenSpace, PHP, MySQL, Flash and Flex, Java and AppleScript (in order to automate lots of tasks).

Stay tuned!