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

What was first: the chicken or the egg?

Here is a little experiment (that was hanging in my drafts for some months already) with static method, static code block, [Mixin] and class constructor. Can you guess correct order of trace()s dispatched by using the following Item class? Notice [Mixin] will only be understood and init() called with flex application.

Read the rest of this entry »

Quick Tip: Update Debug Token on Playbook

After a few weeks I got back to projects for BlackBerry Playbook and I realized my debug token on device is no longer valid. It took me some tome to investigate what steps are necessary to update just the debug token (signing keys are still valid). It resulted in 2 commands. If you like working with command line rather than with Flash Builder with these kind of things, you may find following .bat script useful. The script creates and deploys a new debug token on device.

Read the rest of this entry »

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 »

SWZ, RSL and Flexmojos Build Setup

With default Flexmojo build setup your clients may easily fall into .swz load issue. Why clients? Because you already have .swz files cached in your player but they dont. Sure, you can turn off caching easily. The issue is textLayout and osmf uses a different version numbering and .swz location than the rest of the flex sdk .swzs. The exception by flex application may look something like this:

Error #2032: Stream Error. URL: http://fpdownload.adobe.com/pub/swz/flex/4.1.0.16076/textLayout_4.1.0.16076.swz
Error #2032: Stream Error. URL: http://fpdownload.adobe.com/pub/swz/flex/4.1.0.16076/osmf_4.1.0.16076.swz

Read the rest of this entry »