CATEGORY


AJAX vs Flash

Flash vs AJAX

An der FH Salzburg (Multi Media Art) brandete gestern im Zuge der Vortragsreihe Multimedia-Programmierung ein äußerst interessante Diskussion über die Verwendung dynamischer Datenaustauschtechnologien auf.

Im Prinzip ging es nur um eines Welchen Sinn hat Flash?

Diese Frage hat sich bis jetzt nie für mich gestellt, aus dem einfachen Grund, weil die Beschäftigung mit einem Hype nie mein Fall war, doch was ist AJAX überhaupt.

Grundsätzlich ist es ein im HTTP 1.1 Protokoll definierter Weg HTML-Requests ohne einen Reload durchzuführen. Die eigentliche Mächtigkeit ergibt sich aber erst seit ca. 1/2 Jahr mit der Entwicklung von offenen Java-Script Libraries für diese Technologie die zeitgesteuerte Abläufe einfach ermöglichen. Als tolles Beispiel ist eben jenes System anzuführen, an dem ich gerade eben diesen Text tippe, WordPress setzt mit TinyMCE und der Kategorieverwaltung stark auf AJAX.

Es ermöglicht eine bis dahin in Websites nie gekannte Interaktivität und Usability. Allerdings muss man ganz klar feststellen, dass dies aber erst der Anfang eines großen Schrittes sein kann. Erst eine GUI und ein leistungsstarkes Authoring, bzw. Codekonzepte und der Einsatz von JavaScript-Spezifikation 2 erlauben große Projekte mit stabilem Coding.

Aber nochmal zurück zum Anfang, was ist Flash?

Flash setzt seit Version 7(Flash MX 2004) auf 2 getrennte Authoring-Umgebungen, eine für Animationskünstler und Designer und die Professionel-Variante für Programmierer. In diesem Zusammenhang sind auch 2 Entwicklungsumgebungen besonders hervorzuheben, der in Eclipse implementierte FDT-Editor und ein von Alessandro Crugnola programmierter Open-Source Editor namens SEPY.

Seit diesen Versionen ist ein für Programmierer sinnvolles API-Handling zumindest teilweise implementiert und ermöglicht prinzipiell die Produktion von stabilem sauberen Code. Auch die Produktion von Komponenten und die Entwicklung des Flex-Framework haben wesentlich dazu beigetragen mächtige RIA´s (Rich Internet Application) zu designen.

Diese Trennung der Programmteile war ein wichtiger Schritt um die Prioritäten von Flash neu zu definieren. Flash ist historisch betrachtet ein Tool für Designer und Animateure und entwickelte mit ActionScript eine mehr oder minder fähige Sprache, die auf die Zeitleistenfunktionalität aufsetzte. Mit der Zeit wurde die Entwicklung von Applikationen derart wichtig, dass sich die Sprache auf einer komplett falschen Basis rasant entwickelte. Durch Einführung von ActionScript 2 wurde der erste richtige Schritt getan und die von Adobe/Macromedia veröffentlichte Spezifikation von ActionScript 3 verspricht eine weitere Steigerung.

Wenn man versucht Flash nicht als ein Tool für alles zu betrachten, sondern jeweils die Stärkten der unterschiedlichen Versionen als eigenständiges Entwicklunsgerät zu verwenden ist meiner Meinung nach der 1. Schritt getan. Flash für Entwickler muss ein Compiler werden(wie es bei MTASC bereits als OpenSource umgesetzt wurde) der auf ein starkes, mächtiges und großes Framework aufsetzt.

Flash für Designer und Animationskünstler muss eine zeitleistengesteuerte Oberfläche bleiben und auf die Stärke des Small Web Format (SWF) setzen. Die Überlegenheit die diese Applikation von anderen und natürlich von AJAX unterscheidet ist ein Austausch der einzelnen Komponenen von Entwickler und Designer ist einfach und schnell zu realisieren, die Oberfläche für eine RIA oder ein Spiel sind in einem einzigen Programm zu realöisieren und ermöglichen dem Einzelnen und dem Team eine feste Entwicklungsstruktur für Projekte zu integrieren. Die Verwendung von Editoren wie FDT und SEPY ist mit seinen Refactoring und Entwicklungswerkzeugen ein erster Schritt in Richtung Applikationsentwicklung.

Wenn jetzt natürlich der berechtigte Einwand kommt, Java und Co. sind “richtige Programmiersprachen” und für die Applikationsentwicklung vorgesehen, muss man hier prinzipiell recht geben, allerdings der wirtschaftliche Faktor ist bei Webapplikationen ein wesentlicher im Gegensatz zur Softwareentwicklung, betrachtet man die Durchlaufzeiten bei Desktop-Anwendungen im Vergleich zu Webanwendungen ist dieser gravierend, da die Test und Entwicklungszeiten im Web nur einen Bruchteil ausmachen.

Flash kann eine Lösung für zukünftige Präsentationen im Webbereich und interaktive Anwendungen werden. Was meiner Meinung nach auszuschließen ist, das AJAX und ähnliche Entwicklungen in die Präsentationssparte eindringen können.

Interessanter ist der Vergleich im Bereich interaktiver Anwendungen. Sobald die Entwicklungswerkzeuge und Frameworks von AJAX eine genügend entwickeltes Stadium erreichen, wird die Implementierung um ein vielfaches kostengünstiger und einfacher zu lösen sein als mit bisherigen Flash-Applikationen. Allerdings mit einer Einschränkung, die Strukturen erfordern auch ein serverseitiges Lösungsmodell, dass zu 100% kompatibel sein muss und natürlich in der Einfachheit der Client-Entwicklung nicht nachstehen soll, Macromedia/Adobe haben hier den Vorteil von 10 Jahren Entwicklungszeit und eine Konformität innerhalb der Produktlinie, die zwischen den unterschiedlichen Entwicklungswerkzeugen einen nahezu reibungslosen Austausch ermöglicht.

Wie Fr. Mairitsch (Studiengangsleitung Multi Media Art) ziemlich treffend formulierte ist es eine Frage der Timeline und der Dimension Zeit an dem sich diese Fragestellung entscheiden wird. Fr. Jellinek (Studiengangsleitungsstv. Multi Media Art und Head für Multi Media Programmierung) brachte ein meiner Meinung nach weiter interessantes Argument, das die Entwicklung eines neuen Client und Backend-Modells wie mit Ruby, die beidseitig auf dieselbe Technologie und Struktur aufsetzen der Weg in zukünftiger Webentwicklung darstellt.

Der Konkurrenzkampf Flash vs AJAX und Co. um interaktive Webanwendungen wird in den nächsten 5 Jahren sicher interessant zu beobachten. Eines sollte man aber nie vergessen, Flash bietet ein in eine Sandbox (Flash Virtual Machine) implementiertes geschlossenes Sytem. Es wird auch eine Frage der Performance und natürlich der Wirtschaftlichkeit. Der einzige Vergleich der in dieser Diskussion hinkt und deshalb auch nicht angesprochen wurde ist der Vergleich Director – Flash und Flash – AJAX, weil diese Systemvergleiche meiner Meinung nach auf Grund der unterschiedlichen Ausgangssituation nicht möglich ist.(Geschlossenes System, proprietär, etc.).

Was AJAX aber absolut einen Startvorteil verschafft, bestehende und bekannte Strukturen zu verwenden und als Open-Source Implementierung natürlich frei verfügbar zu sein.



Games from the Scratch

In about 24 days there is christmas eve and my company come to me some weeks ago. They want to have a XMAS Game wich has to be easy to play and the user has to be amused, because there is some product placement inside.

In the last weeks there was a lot of stress in my life, because nearly for all people around me i had to do something.

So i had to thougt about a concept which is powerful enough to bind the players and which is easy to build. The games i have built this year were very complex and heavy to program. I have built up a (to)big class library especially for game enviroments like Mode7, Isometric and Tiles.

Since 2 years i am also using external editors, like SEPY or the Powerflasher FDT-Plugin. This are very powerful tools, but every new tool requires some time for introducing into it.

So i thougt about my earlier times, when i started with Flash 5 and my first Action Script 1 programs.

[as]_root.gotoAndPlay(“framename”);[/as]

I decided that this old concept maybe has to get another chance. I have been drawing some scribbles, turned on my 3D-Modeller and have rendered some animations. After this concept and gfx-step i reserverd a keyframe for every frame and action.

Keyframes

Most of you now will say, oh my god this is so quick and dirty.

Yes, you are right! But have you ever thougt about this statement.

Quick and Dirty

You can write AS1 syntax which is very easy to understand for nearly every webdesigner(also for those who are more designer than producer) and you do not have to think lot about design patterns, OOP and something like this. There is no need for a concept time, only programing.

OK, the dirty part. As i have already said, there is no concept and no structure in your code. You have to search for your scripts in the whole .fla file.

But if you ever have some stress like i have the last weeks you better thougt about a solution like this. The only difference between AS1 programing i have done years ago and today is the use of AS2 features.

Strongtyping
[as]
var c:MovieClip;

c = _root.attachMovie(“c”, “c”, 1)
[/as]

Look at Spielzone.at tommorow(Dec, 1.) for getting the result of this concept.



AS3 Samples, Flex 2 Applications, Linklist

Maybe this is more for my own than for the public but i think it could be also interesting for you.

Here is a list with Samples of new MM technologies i have found in the last week.

One of the most impressive works are made by Andre Michelle.

Andres Samples

A more theoretical way is done by Ralf Bokelberg. He described the new language features of AS3.

Colin Mook has announced a new entry onto his blog, where he is writing about his new book ActionScript Essentials 3.



Flex 2 Public Alpha

Macromedia has announced a new portal for developers. With the Macromedia labs the company is going a new wey in their strategy.

By time their are some alpha releases of Flex 2, Flex Framework and the Flash Player 8.5. If you are a interested RIA developer this alpha release is a must have. Today it was my first time with a flex product and i was surprised how fast you can create RIA´s with it. I am using the Eclipse plugin(codenamed Zorn). For me the IDE is nearly complete, their is an easy way to debug the application threw the Flash 8 authoring enviroment and you are able to run and compile the application directly threw the eclipse IDE(Run As -> Flex Application).

But what i am most suprised was the new Action Script Virtual Machine which is included into the new Flash Player 8. I have seen tests withit and the new scripting language ActionScript 3 and i was very surprised by the results. Up to 100!! times more performance for specific applications. And what i like also a lot is that the guys from MM have not implemented the old AS 1 and AS 2 waste into this virtual machine.

There are also several new features wich are supported by Player 8.5, one of them is i have already said the AS 3 language, but read the articles at the MM labs.

see ya in a completly new RIA world ;)



Action Script 3

Macromedia has announced a new step of their famous Flash Platform. They have released an Alpha state version of their Flex 2 framework, Flex Builder 2 and Flash Player 8.5.

Flash Player 8.5 provides a new milestone in flash history, Action Script 3.

Action Script 3 becomes a very stable, clean and powerful language and i hope it will be integrated into Flash Authoring Enviroment as well.

They have built in a new ActionScriptVirtual Machine into the coming up Flash Player.

Some of the new features are:

– E4X (ECMA Standard for native object XML support)
– reorganisation of the Flash API
– new primitive data types
– create display objects threw the “new” operator
– and many more

For a little bit more detail, read this article from the macromedia labs.

MM has also set the livedocs for ActionScript3 as a public.



Will become a tutor

Yesterday i had a little conversation with the lecturer of MultiMedia Programing and Informatics.

They offer a job as a tutor for MultiMedia Programing and Informatics.

The students will learn the principial technologuies of the WWW like Protocols, HTML, Flash, PHP, MySQL and much more in about 6 episodes.

It is my first employment as a tutor and i am a little bit nervous ;) .



Client validation in Flash

For a flash game platform a friend and i were searching for a security solution.

The problem with flash is that a possible hacker could decompile swf-files and looking for the URL where the score of the game is uploaded. For sure obfuscater is a possibility, but we are searching for a method which is not decompileable in any ways.

In flash there are some properties of movieclips which are not readable with the common AS Decompiler (Sothing, Burak, etc.). And there are undocumented methods and AS 1.0 hacks which made it nearly impossible to understand the code.

With this primitive possibilities we have tried to build a secure checksum. This checksum will be send to server where a PHP script check if it is valid or not. The important thing was to generate a key with all these parameters which is not readable threw a Decompiler. For a better camouflage we use some hacks with __resolve, static variables, pseudo functions and a little bit we obfuscate the code.

As a summary we can say, a pretty secure solution, but we know the disadvantages. If there is the chance to win a big price, maybe 99% of possible attacks will be a failure, but the 1% percent left is enough anger. Never use only flash based solutions for things wich require security standards and obfuscate what you can.

For an increase of security we build-in some other features, like Sessions, SSL(Secure Socket Layer) and a random based interval where we check the validation. Another possibility would be given threw a XML-Socket, but maybe this is oversized for 99% of all flash games.



Strange behaviour with Load Vars Callback

Today i want to implement an easy contact form in one of my older projects but there was a strange behaviour.

I have created 2 new instances of LoadVars class and set a release event on to a button for calling a sendAndLoad event.

[as]
public function init():Void {
mailInfo = new LoadVars();
mailStatus = new LoadVars();
mailStatus._container = this;
mailStatus._container.sucField = _container.sucField;
mailStatus.onLoad = onMailLoad;
}
public function release():Void {
mailInfo.fVorname = _container.forename.text;
mailInfo.fNachname = _container.surename.text;
mailInfo.fEMail = _container.mailadress.text;
mailInfo.fFeedback = _container.feedback.text;
mailInfo.sendAndLoad(“kontakt.php”, mailStatus);
}
[/as]

This is the callback function

[as]
public function onMailLoad(success):Void {
if(success) {
_container.sucField._visible = true;
_container.sucField.gotoAndStop(1);
} else {
_container.sucField._visible = true;
_container.sucField.gotoAndStop(2);
}
}
[/as]

The callback is defined in the same scope where loadVars are defined.

The problem:

After compiling fla-file and testing contact form, i recieved email and get answer from server(i tested with packet-sniffer Etherreal), so i thougt, what the hell is wrong.

The next try i set an additional debug textfield in my fla and trace the reference to the class where the callback is defined and to the output field which is set visible in callback function.

Both where undefined and so thought about how it was in Action Script 1.0 . There you have to create an anonymous function if you wanna get a callback, or setting an other function to overwrite the LoadVars onLoad.

Example:
[as]
var l = new LoadVars();
var l2 = new LoadVars();

l2.onLoad = myFunction;

l.sendAndLoad(“test.php”, l2);

function myFunction() {
trace(“callback”);
}
[/as]

With this construct the scope of the function was to the LoadVars object l2.

In ActionScript 2.0 there is the same behaviour, the function onMailLoad will be called, but with another scope. It is not longer member of the class where the method is defined, but the method is member of loadVars instance.

very strange



SWF Obfuscator

An Obfuscator is a tool which allows you to save your bytecode from the decompiling gang.

After obfuscating a precompiled file under normal circumstances it is not possible to decompile.Why?

Not all Obfuscator tools works similiar or produce exactly the same output, but the concept is nearly the same. One idea is to rename variable names to constructs like this; “ooooooooooooooooooox”, no one will be able to read source code like this. But a good decompiler maybe could reproduce the code. So what can a good obfuscator do?. A solution is to rename source via a mathematical formular and a key-string.

The developers of the Motion-Twin Action Script Compiler have a page on their website where they serve a tool for irreversible obfuscating. The only possibility is maybe a brute-force attack, but only for short variables.

The tool is called OBFU (for OBFUscator).

Obfuscation process is irreversible. Every identifier string found in the SWF is hached with a irreversible proven mathematical function. For short variable names however, brute force is still a possible attack. In order to prevent this Obfu accepts an obfuscation key as parameter (using the -key parameter). Two SWF will be obfuscated in the same way if and only if they have the same obfuscation key. In order to ensure maximum security, one should use -rndkey to generate a random key everytime an obfuscation is done. If however several SWF needs to communicate between each other, there is several possibilities :

* use the same keys (with -key) for the two SWF. This way they will be obfuscated the same way and thus a function f declared in the first SWF and called in the second will be correctly executed.
* protect the variables that need to be shared so they don´t get obfuscated (see below).

Sounds good, but there is only one problem, professional licence costs are about 1500 $.

Maybe only for agencys, but if you have seen the results in the sample swf, it is maybe rentable.




© 2006 - 2012 Hannes Wolfgang Moser