Archive for the ‘Flash development’ Category

Vesti bune pentru Flash

Thursday, May 1st, 2008

De multe ori cand intrebi ‘programatorii adevarati’ (a se citi Linux Open Source obsessed ๐Ÿ™‚ ) despre Flash si de ce nu il prefera iti vor spune ‘pentru ca este proprietar, nu poti sa faci ce vrei tu cu el, etc’.

Astazi Adobe a anuntat deschiderea formatului swf, o veste buna pentru comunitatea Flash si pentru platforma in general.

Wadhwani said the Open Screen project has five basic elements. Adobe will remove license restriction on the .swf file format. “It is published already, but in order to view it you have to say you will not create a competing player,” said Wadhwani. “We’re lifting that restriction. People have been worried about vendor lock-in. This will remove that obstacle, and concern.”

Deasemenea Adobe va renunta la taxele pentru telefoane mobile, intelegand in sfarsit ca this is the only way to go.

Adobe will also remove licensing fees for embedding Flash Player on devices. The software has always been a free download for PC users. But Adobe has charged for embedding on devices. Those charges will disappear with the next release of the software.

Continuous Actionscript 2 and Actionscript 3 unit testing

Wednesday, November 7th, 2007

This is a very technical post, so if you are not interested in Actionscript or Unit Testing, you can stop reading.

Some context
A few weeks ago I gave a talk to the Flash Coders NY group about Unit Testing. The talk was mainly oriented towards the benefits of unit testing, but since I’ve taken the time to set up an automatic test runner for the talk, I also took the time to clean it up, make it work for Actionscript2 and make it as easy to use out of the box as possible.

Hopefully this will lower the frustrations of all those that want to start looking into Actionscript Unit Testing but get turned off by all the broken links, complicated tutorials and puzzles that you need to put together to get it working.

So what is this?
Hopefully, an out of the box automatic test runner for both Actionscript3 and Actionscript2 (I couldn’t find any other for As2). Included are also some small unit tests so you can start playing with it fast (out of the box, right?).

By automatic I understand a test runner that compiles, runs and closes without the need of a user, but only through a script, and prints all it’s output to stdout. All of these are necessary conditions for setting up a continuous build, something that is very desirable (since we are all very lazy).

If you are really lazy
If you are too lazy (or too good ๐Ÿ™‚ ) to read all this, just download and try it out. If it doesn’t work, come back and read on. I suspect you’ll come back. ๐Ÿ™‚

System requirements
I’ve worked on this on my MacOS X, I also tested on Linux. It should work on Windows too (but I admit I have not tested yet, I should do it these days).

On your machine, you also need:

  • a standalone Flash Player 9 in your command path (I’ve put mine under /usr/local/bin on linux). You can download it from here.
  • on MacOSX you have to make sure that the standalone Flash Player is the default app for opening swf files. If from a terminal you type “open SomeExampleSwf.swf” and the flash player opens with that file, it’s great. If not, make that happen.
  • you need javac, ant, mtasc (if you want As2) and the flex sdk (if you want As3). If you are thinking of Unit Testing, you should be able to install those yourself. ๐Ÿ™‚
  • Steps to run your first unit tests

  • 1. Make sure the system prerequisits are met
  • 1.1. If you plan on running the As2 Unit Tests you need to do an extra step, you need to add your path to the FlashPlayerTrust directory.
    On MacOS: Create a directory /Library/Application Support/Macromedia/FlashPlayerTrust
    On Linux: Create a directory /etc/adobe/FlashPlayerTrust (or ~/.macromedia/Flash_Player/#Security/FlashPlayerTrust)
    On Windows: C:\windows\system32\Macromedia\Flash\FlashPlayerTrust
    In that directory, create a “trust.cfg” file and add a path to your favorite directory in that file. This will tell the flash player to trust the swf files in that directory.
  • 2. Download and extract it in your favorite directory.
  • 3. Edit such that the mtasc and flex.sdk paths match your configuration.
  • 4. From the directory where you extracted the archive, in a terminal, type “ant”.
  • You should be all done. If it doesn’t work, let me know (I swear, it works for me ๐Ÿ™‚ ).
    [update] You should also take a look at the video here, a project that became ProjectSprouts (don’t let the name turn you off). Worth checking out.[/update]

    What might not work

  • This should work on Linux, MacOS and Windows. I only tested on MacOS (where I cleaned everything up) and Linux.
  • If you have trouble with the security sandbox (the swf opens, but it throws an error) read more about FlashPlayerTrust.
  • If ‘ant’ has trouble launching the flash player, there is some issue with your standalone flash player and path.
  • If you have trouble compiling your swf’s, there are issues with MTASC and the Flex compiler. Check that they are set up correctly and that you can manually compile stuff with them.
  • Some final thoughts
    This is put together starting from the work done here by a guy named Peter Martin. As all the other tutorials they are made from many pieces and you have to tune everything for it to work, so I wanted a super easy out of the box solution. Credits do go to Peter Martin, I just cleaned his work, made it output to stdout and made it work with As2.

    A good resource for related work done by various people is here.

    In order to make AsUnit (actionscript2) work, I had to make some very very slight changes to AsUnit (to allow a listener deeper investigation of
    the framework). This means you can’t just replace AsUnit code with newer code, it will stop working. The good news is, I got it working for As2 (which nobody else did as far as I can tell, they are all blinded by flexunit ๐Ÿ™‚ ).

    FlexUnit is out of the box (no changes there).

    I’ve left the Eclipse/Flex files in the directory, so ideally you could import this as a project into Eclipse and simply run it with Ant, so that you could make development and testing a breeze.

    The runner produces some XML output too, for some software called Cruise Control (I never used it). I had to change the java socket listener to display text output (this was a substantial part of the work, along with the as2 port).

    Flash Coders NY

    Friday, June 22nd, 2007

    Stiti ca vorbeam acum o vreme despre networking si cat de imporant este? Well, tocmai am fost la o intalnire a Flash Coders NY. Destul de interesant, informal, nu foarte multa lume. In plus, nici foarte multi programatori care sa dezvolte pur cod fara sa fie implicati in a face site-uri, a avea de a face cu UI, mocks, designs and stuff like that.

    Incep sa ma simt singur, nu numai ca fac parte dintr-o comunitate mica (programatori Flash), dar formez o comunitate si mai mica a celor care nu ‘fac site-uri’ flash ci scriu Actionscript pur. ๐Ÿ™‚

    Mi-a placut, am invatat lucruri noi si am cunoscut niste oameni care faceau lucruri destul de interesante.
    Oare in Bucuresti exista vreun grup de programatori care sa faca intalniri regulate?

    Flash Player 9 a ajuns deja la 83%

    Tuesday, April 17th, 2007

    Damn it, penetrarea versiunilor noi de Flash Player devine din ce in ce mai rapida. Nu mai am rezistat si in seara asta am luat la puricat Actionscript3. Woohoo! ๐Ÿ™‚ Este incredibil cat de mult a evoluat Flash-ul, ce vremuri dom’le cand faceam site-ul Divertis in Flash4. ๐Ÿ™‚

    Incep sa ma simt batran. ๐Ÿ™‚

    FlashForward Austin wrap-up thoughts

    Friday, September 15th, 2006


    Flash Forward in Austin is over.

    The conference was ok but I couldn’t say I am super excited about it. I met some nice people, but then again, also met some very full of themselfs speakers too. ๐Ÿ™‚

    And because there were a lot of young speakears, it made me wonder if maybe Flash has the developers it deserves. ๐Ÿ™‚ I can see Actionscript being like the snowboarding of programming languages, where as Java is like skiing, C++ hardcore skydiving without a parachute and LISP some sort of golfing. You can do really neat tricks on a snowboard, but how come the Olympiads are won only by 17 year olds? ๐Ÿ™‚

    On the upside, I went to some really inspiring presentations like the one from Hillman Curtis about how he is doing video now. There has been some nice stuff about Apollo and the vision of the Adobe guys on it (though it’s pretty alpha and they didn’t sort out some of the details).

    There was a nice session on how the garbage collection in AS3 works and how easy it would be to skrew things up with memory leaks. While he had good points and recommendations about using weak references, I have doubts about his need for using weak pointers *everywhere*. ๐Ÿ™‚ I mean… listeners, hash maps, caches, okay. But everywhere?

    On the downside, there were a few sessions that really made me angry. One, about Flash controlling the browser, where the speaker was recommending that you embed Javascript code inside the Actionscript code. Just keep it there as a string and then do a getURL(‘javascript: eval(str)’); on it, he was saying. This is so wrong from so many points of view that I just got up and left.

    Another talk that dissapointed was the guy from Yahoo that was supposed to talk about AS2 to AS3 migration. Instead, he presented the Yahoo Maps API written in AS3, talked about all the things you can do with it and advertised Yahoo flash-related jobs in the end. That was just plain wrong.

    All in all, it was nice being there, though it will probably be my first and last year at FlashForward.

    Flash Forward Austin 2006

    Tuesday, September 12th, 2006

    Flash Forward Austin

    So i’m here. Flash Forward Conference, 2006. O editie aniversara, Flash a implinit 10 ani anul asta si ce e drept, s-a dezvoltat si s-a schimbat mult pe parcurs.

    Prezentarea la care sunt acum vorbeste despre Apollo care vrea sa ofere un framework si un runtime pentru aplicatii care ruleaza la fel pe orice OS si orice masina. Scrii o singura data si distribui anywhere. Suna cunoscut? ๐Ÿ™‚

    Bineinteles, vor sa reuseasca acolo unde Java nu a reusit acum 10 ani. O idee interesanta, ramane de vazut daca vor reusi sa reinventeze acest concept si sa repare punctele acolo unde Java a gresit. Fostii entuziasti Java (chiar asa, mai e cineva care crede ca Java mai poate produce desktop applications? ๐Ÿ™‚ ) vor urmari probabil cu scepticism evolutia Apollo. We’ll see.

    Asa ca pentru cateva zile probabil ca voi posta ceva mai… development related. ๐Ÿ™‚ Cheers from Austin, Texas.

    [update] Am intrebat de ce crede prezentatorul ca vor reusi unde Java nu a reusit. Raspunsul lui a fost ca, atunci cand Java a aparut nu a existat o nevoie din piata care intr-adevar sa caute un raspuns.

    Ideea a fost si este foarte buna, dar nimeni nu simtea nevoia asta. Ei cred ca in acest moment nevoia exista. Out there sunt toate aceste aplicatii-web care apar si care au succes pentru ca ruleaza in orice browser, pe orice masina, la fel. Mizeaza pe faptul ca dezvoltatorii acestor aplicatii vor vrea sa le mute pe desktop unde sa mearga mai repede si sa scape de limitarile browserelor.

    Eu unul sunt inca sceptic. Multe lucruri trebuie sa se intample asa cum trebuie ca viziunea asta sa functioneze and you never know daca chiar or sa se intample asa cum trebuie.

    [update2] un sumar al prezentarii Adobe de dimineata si niste link-uri utile pe blogul conferintei.

    Despre Actionscript si hashuri

    Thursday, December 22nd, 2005

    [daca nu sunteti programatori, puteti sari mesajul asta dar sa nu va suparati, ca titlul spune “developer’s blog” ๐Ÿ™‚]

    FlashFlash-ul nu inceteaza sa ma mai uimeasca din cand in cand cu cate o chestie. ๐Ÿ™‚
    Se pare ca Actionscript suporta nativ hash-urile la nivel de obiect incepand cu Flash Player 5 si o face extrem de flexibil… iar eu am aflat abia azi. ๐Ÿ™‚

    At its core, an associative array is an instance of the Object class, and each key-value pair is represented by a property and its value. […] The following example creates an associative array using an object literal, accesses items using both the dot operator and the array access operator, and then adds a new key-value pair by creating a new property:

    var myAssocArray:Object = {fname:"John", lname:"Public"};
    trace(myAssocArray.fname); // Output: John
    trace(myAssocArray["lname"]); // Output: Public
    myAssocArray.initial = "Q";
    trace(myAssocArray.initial); // Output: Q

    Sursa aici.

    Partea proasta? Nu ai functii implementate pentru a controla diversi parametri ai hash-ului sau a ii numara elementele de exemplu.

    Din aceeasi serie de mici descoperiri vad ca si documentatia pentru Flash8 este mult mai buna decat documentatiile de la versiunile anterioare. Yuhu! Deh, cand dezvolti site-uri de larg consum (ca doizece sau 5pm) esti mereu cu cateva versiuni in urma. ๐Ÿ™‚

    Programare extrema

    Friday, December 2nd, 2005

    Flash runeImi place Flash-ul pentru ca ma fortzeaza sa fiu extrem de eficient atunci cand programez… si ma face deseori sa realizez ca unele lucruri puteau fi facute si mai simplu, cu acelasi rezultat final. Complexitate, structuri de date, preprocesari, toate conteaza. Trebuie sa fiu eficient la sange, O(2n) este departe de a fi O(n) si daca vreau sa fac mai mult de 1000 de operatii pe frame, ar trebui sa ma gandesc de doua ori.

    E un dezavantaj atunci cand unele lucruri pur si simplu nu pot fi facute. Mi-a scos peri albi, mi-a generat frustrari, nervi si toate cele. ๐Ÿ™‚ … cine a mai programat Actionscript, stie despre ce vorbesc. ๐Ÿ™‚

    Dar este un deliciu atunci trebuie sa fac compromisuri intre calcule sau aproximari ale acelor calcule, intre ce as vrea sa iasa si ceva aproximativ la fel, intre un rezultat real sau un rezultat care ofera iluzia realului… si-mi iese. Este deliciul creativitatii.

    Si tuturor ne plac provocarile care se termina cu bine, nu? ๐Ÿ™‚

    Dezvoltare de aplicatii Flash in Eclipse

    Thursday, October 6th, 2005

    Se pare ca Macromedia a ascultat si vocile dezvoltatorilor care simteau nevoia de un IDE bun pentru codare in Flash si in curand vor scoate un produs care integreaza dezvoltarea Flash in Eclipse.

    Sursa: zdnet, macromedia.

    Abia astept! ๐Ÿ™‚

    Flash8 is here

    Friday, September 16th, 2005


    S-a lansat si, ca de obicei, de pe site-ul Macromedia poate fi descarcat un trial de 30 de zile.