A Sound In Image Experiment

There are some usefull apis since Flash Player 10, I have never been playing with. Yesterday, I realized one experiment with Sound + SampleDataEvent and created quick demo for converting music into a bitmap and vice versa.

There is a Sound.extract() method in ActionScript allowing you to grab raw sound data from a sound object. It provides you ByteArray of 32-bit floating-point values, which can be converted to a Number using ByteArray.readFloat(). The resulting values are -1 < value < 1...

Read the rest of this entry »

SequenceParser – Simple yet Mighty

With my latest approach to create universal parser, I came up with something simple yet mighty. SequenceParser is a simple (30 lines) class that crawles any source and matches specified list of highly customizable ISequences. While each sequence can contain list of nester sequences, you are able to parse any type of source with nested conditions and sequences. A good example can be an attribute inside a xml node, a xml node inside a xml node, an escape character inside quotas etc.

I have also created some example sequences like MatchAnything, MatchRegexp, MatchString, StartRegexpEndRegexp, StartRegexpEndString, StartStringEndString that should help to cover almost any possible parsing scenario. These sequences notifies back via callback containing parsed string, that is vital for further bulding additional logic like highlightning, validation over parsed phrases.

Read the rest of this entry »

Quick Tip: OSMF VideoPlayer Screenshot

Your video is usualy resized and played in a custom sized rectangle, but if you need to capture the fullscreen screenshot you may be tempted to gather the original size screenshot by resizing the whole component or its part. Its not the best practice, while you need to resize and move back and forth the component etc. Here is a quick tip to make a fullsize screenshot from spark osmf based VideoPlayer using Matrix.

Read the rest of this entry »

ActionScript 3 Date

Did anyone alse than me wondered about Date.toString() output format in AS3? I mean what standard is it? It looks like something that adobe created for flash purpose and is not used anywhere else(?). According to the documentation AS3 output format for date is.

Day Mon Date HH:MM:SS TZD YYYY
Fri Sep 2 14:49:30 GMT+0200 2011

Read the rest of this entry »

Layout For A Table

There are some hidden treasures deep in flex framework, you just have to dig for. Yesterday I hit by coincidence ConstraintLayout. Its a part of 4.5 SDK and is a nice layout for defining rows and columns for a table. Once columns and rows are created, your elements are not automaticaly aligned into a block, but rather any element can refer to any column/row using correct formula in style attributes. E.g. forumla left=”{columnId}:{value}” will attach your element into position of a column and offsetting it by some value. This layout also easily let you merge cells or rows etc.

Read the rest of this entry »

Quick Tip: Read timed out …/target/test-classes/TestRunner.swf

There has been a terrible issue blocking maven/flexmojos builds randomly with exception:

[INFO] Read timed out /home/user/project/target/test-classes/TestRunner.swf

Even there are some tips how to fix this issue, none of them worked for my case. After all unit tests were removed and one by one added back manualy, I was able to locate the tests causing it. Problematic appeared to be async unit tests and the random factor appeared to be cpu usage. In other words when flashplayer was not able to execute and finish async test, it failed with maven exception. Finally, the day was saved with changed testTimeout value:

<configuration>
    <testTimeout>60000</testTimeout>
    ...
</configuration>

Maven version: 2.2, Flexmojos: 3.8, Flex SDK: 4.1.0.16076, FlexUnit: 4.0-rc-1

Quick Tip: Installing AIR Runtime To Android Emulator

After I have installed Android SDK on a new machine, I have almost forgotten the steps necessary to run AIR application on Android emulator. There has been some changes within android sdk e.g. adb.exe is no longer located in “tools” dir but rather in “platform-tools”, to create a new emulator you can use SDKManager.exe… and to install AIR runtime on Android emulator, you can take .apk file located in AIR SDK (airsdk/runtimes/air/android/emulator/Runtime.apk) and install it via…

Read the rest of this entry »

Getting hands dirty with molehill

Few weeks ago I played with molehill and Away3D engine. Creating 3D scene is straightforward with an engine, but I still wanted to get deeper inside and understand the low level api and agal. So I took another approach and created pure molehill version of 3ddm. Soon I realized that I have been already familiar with some procedures from drawTriangles version so I could easily use algorithm for defining vertices, indices and uv.

Read the rest of this entry »

Universal Application To Module Api

While working on my latest project, I was supposed to came up with some elegant solution (api) to make 3rd party modules be able to communicate with the main application and vice versa. In fact I already did the approach some time ago, now it was time to improve it and implement into a flex framework.

The api is based on event dispatching. Instead of sharing interface and calling some public available functions / callbacks (requires functions defined in compile time), event based api gives you the freedom of registering and releasing listeners anytime in runtime…

Read the rest of this entry »

Quick Tip: Debugging Module Inside Non-debug Application

Did you know that it is not possible to debug loaded content within release (non-debug) build app? Every attempt to insert a breakpoint during the runtime will cause null pointer exception thrown by flash builder, however you can still trace() output. To be more specific, imagine you have main application deployed somewhere on the web and you want to debug a module you are just developing wrapped inside the main application. Sure you can use proxy mapping trick + custom run configuration, that would help you run your debugging version of module.swf, however while the main application is non-debug version, the flash builder debugger will just not work correctly. Luckily you have two options to make it work. First, you may also map the main application .swf file for your debug version (+ some flex rsl files) or second option, make the flash player wrap whole content into some .swf compiled in debug mode using PreloadSWF in mm.cfg.

Read the rest of this entry »