Archive for the ‘Tricks’ Category

Flash: Convert a function reference to a readable string

Friday, April 23rd, 2010

Temple Flash Library IconIf you have a function reference in Flash there is not a lot of information you can get from it. Converting the function to a string will only give you: (more…)

How to set MXMLC (FCSH) to English (on Windows)

Thursday, March 25th, 2010

If you are working in the Netherlands on a pc with MXMLC (FCSH) you probably get all your errors in Dutch, like:

Functie heeft geen hoofdtekst.” or “Waarde van het type Function is gebruikt waar type void werd verwacht. Mogelijk ontbreken ronde haakjes () na deze functieverwijzing”.

Funny, but not very handy since most help and documentation is in English. So I wanted my errors in English. FCSH does not have any option to change the language. Changing Windows to English doesn’t change anything and setting the location to U.S. doesn’t help either. Finally we found out that setting the format to”English (United States)” will set MXMLC to English:

Format options

Unfortunately this will also change your number, currency, time and data formatting. But you can customize this back to the Dutch settings.

Temple open sourced.

Monday, March 22nd, 2010

Temple  Flash Library IconTemple‘ is the name of our AS3 library we use at MediaMonks. Almost all of our AS3 projects are using it. The Temple is inspired on several 3rd party libraries like ASAPLibrary, AS3CoreLib and CaseLib, but adapted to fit our needs.

The Temple consists of several classes we use on a regular basis. They are designed for reusability and optimized for performance and memory usage.  The Temple is specially designed to work with other frameworks like Gaia. The core of the Temple focuses on: debugging, destruction and memory management.

Debugging
Many classes are debuggable and have a ‘debug’ property. When this property is enabled, the object logs debug messages which allow you to see what the object is doing. All debuggable objects can be managed by the DebugManager. The DebugManager allows you to run all objects in debug mode.
All messages are logged through the Log class which is easily extended for usage by other logging applications, like Yalog and DeMonsterDebugger.

Destruction
All objects are destructible. By calling the destruct- method, the object will clear all of its data, removes all event listeners, removes itself from the display list (DisplayObjects only of course) and makes the object available for garbage collection. Destruction is recursive, so an object will also destruct all its children.

Memory Management
All Temple objects are tracked, via weak reference, in the Memory class. You can view all objects in the Memory class. This makes it possible to detect if an object’s destruct method is working correctly.

More
We also added many nice utility classes for the initial release of Temple, however there is a lot more to come. Since we are keen on stable, neat, and well documented code we are initially only releasing the core of the Temple library. This code has been used and tested and has proven to fit our requirements. There is a lot more we are planning to release soon, like UI components (buttons, form components, video player), loaders (CacheLoader, ImageLoader) and behaviors.

The Temple can be downloaded from Google code and the documentation can be viewed online.

For updates follow us at Twitter.

The Temple is released under the GNU General Public License which allows you to use, extend or modify the code to whatever you want.

Cache and preload Gaia pages

Monday, January 25th, 2010

Gaia Flash FrameworkI use Gaia a lot. I think it’s a great and powerful framework to create page-based Flash sites. But there is a problem: Gaia creates a SWF for every page. And every time you visit a page, the SWF is loaded again. Even if you already visited that page. Also it is not possible to preload pages you are not visiting.

To make page caching and page preloading possible, I have created the ‘CacheLoader‘ and ‘CacheURLLoader‘ classes. Both classes make use of the ‘LoaderCache‘ to cache the SWF files used by Gaia. Just add these 3 classes to your project and you only have to adapt 2 Gaia classes to enable this feature: (more…)

Gaia: Run pages standalone

Sunday, October 18th, 2009

Gaia Flash FrameworkI am a huge fan of Gaia Flash Framework, I use it for almost all my projects. It is a great framework if you want to create solid and maintainable Flash websites.

But as with many Frameworks it comes with some disadvantages; Gaia creates a .fla file for every page, but a page will not run standalone. After compiling the .fla file you have to test the page through the main.swf. For a huge project this is very unwieldy and inefficient.

So I created this “GaiaStandAloneRunner” which enables you to run your Gaia pages standalone, even with all the assets and SEO copy defined in your site.xml. The code only adds about 0.6 KB to your page swf file. (more…)

Prevent page scroll on mousewheel instead of Flash - Hack

Thursday, October 1st, 2009

If the HTML is larger than the browsers window, using the mouse-wheel will always result in a page scroll in AS3. That’s a bummer if you want to use the mouse-wheel inside the Flash.  This problem is better explained here.

After a lot of Googling I found out there wasn’t a good solution for this problem. So I build something that works. (more…)

A Hybrid website: Flash & HTML

Tuesday, September 29th, 2009

Building the ‘VARA – Biografie‘ website.

VARA - BiografieWhen I saw the design of de website I had to choose if we should use Flash or HTML. Mostly when design and animation is leading I choose Flash. If the content is more important and there is a lot of text, I choose HTML. But for this site the top of the website with the timeline and media player has video and animations. But the rest of the site is mostly text. So 100% Flash or 100% HTML didn’t fit our needs. The best solutions would be if we combined Flash and HTML to get ‘the best of both worlds’. (more…)

Flash bug when enter fullscreen keyboard events fired - Workaround

Tuesday, August 25th, 2009

For a project I am making a videoplayer which can be controlled by the keyboard. The spacebar is used for toggling between play and pause. But a bug inside the Flashplayer causes my videoplayer to pause or play when entering fullscreen mode. Since this is really anoying I wrote a workaround which seems to be working very nice: (more…)