Category Archives: Flash, Flex and AS3

Free Transform Manager As3 v1.5.1

Many of you have been emailing me about supporting objects with non-top-left registration points. Here’s an update that recognizes and compensates for all registration points. Give it a try and let me know if it works. You can find the older version here.

[kml_flashembed movie=”http://ryantan.net/content/FTM/TestFTM.v1.5.2.swf” height=”600″ width=”630″ /]

Download:
v1.5.1 Source + Examples
v1.5.2 Source + Examples

Added a dragArea property in 1.5.2 that accepts a flash.geom.Rectangle that specifies the area the objects a confined to. But it has not been fully tested so please do report bugs when you are using them.

Some of you also asked about how to use FTM in flex, here’s a simple .mxml demonstration: Continue reading

Size mismatch when getting BitmapData from Camera

Recently while trying to capture a frame from my webcam in Adobe Air, I realize the captured image is always smaller than the height or videoHeight from the Video object. The BitmapData documentation revealed that the BitmapData.draw() operation does not respect any matrix transformation applied on the Camera or Video object, so we need to do the scaling ourselves. A quick and dirty way would be:

 

//var video:Video; and a Camera object is already attached
var matrix:Matrix = new Matrix();
matrix.scale(video.width / 320, video.height / 240);
bitmapData.draw(video,matrix,null,null,null,true);

 

 

Running your app in the BlackBerry Simulator

The BlackBerry OS SDK currently only supports Flash Builder 4.0.1, not Flash Builder 4.0. When following steps described in BlackBerry’s own Getting Started Guide to launch your app in the simulator, users of Flash Builder 4.0 will get an internal error:

An internal error occurred during: "Launching [your project name]".
com.adobe.flexide.launching.air.ApolloLaunchConfiguration.getAIRProfile()Ljava/lang/String;

To overcome this, either download the 261MB patch from adobe, or use the command line packager which comes included with the BlackBerry OS SDK.

Using the command line packager

In essence, there is only one command that you’ll need, the syntax is:

blackberry-airpackager -package output_bar_file_name -installApp -launchApp
project_name-app.xml project_name.swf any_other_project_files
-device IP_address

What you’ll need: your project name, your BlackBerry simulator’s IP address, the .swf of your project which is compiled by Flash Builder using the normal tools (Project->Build Project or export release build). And remember the output_bar_file_name must end with the extension .bar. If you forget this, however, the error describes it quite plainly to you. For me, a working command looks like (where “AirTest” is my project name):

blackberry-airpackager -package AirTest.bar -installApp -launchApp AirTest-app.xml AirTest.swf -device 192.168.92.128

(If you are not familiar with running commands in windows, you need to add the path to blackberry-airpackager.bat in your system’s “path” environment variable.)

Do I have to run that manually everytime?

Fortunately, you don’t. The command can be configured as a builder in Flash Builder 4.

  1. Go to Project->properties, and under Builders, click on the “New” button to add a new builder. Select type Program, give a name to the builder (any will do, I named mine “BBLauncher”).
  2. Enter the path to your blackberry-airpackager.bat in the location field. Mine was:

    D:Program FilesAdobeAdobe Flash Builder 4sdksblackberry-tablet-sdk-0.9.0binblackberry-airpackager.bat

  3. Enter the path of your project in the working directory (the folder where you find your main .as file, likely your current “src” directory).
  4. And Lastly, in Arguments, enter the options of the command:

    -package AirTest.bar -installApp -launchApp AirTest-app.xml AirTest.swf -device 192.168.92.128

Move this builder to after “Flex” and “AIR application.xml Builder”, and you are done. From now on you can launch the app in the simulator by doing a Project->Build project.

Posts that helped me: http://supportforums.blackberry.com/t5/Tablet-OS-SDK-for-Adobe-AIR/Getting-Internal-Error-When-Attempting-to-Debug/td-p/621952/page/2

Installing BlackBerry Tablet OS SDK for Adobe AIR

Users of 64bit windows might get frustrated installing the new BlackBerry Tablet OS SDK if you are not using the 32bit Java Development Kit (JDK). When you run the .exe from BlackBerry, an error claims that “Win64 not supported. The author of the package you are installing did not include support for this platform.” The solution is trivial:

Unzip “BlackBerryTabletSDK-Air-Installer-0.9.0-Win.exe” and you should see 2 folders, “InstallerData” and “Windows”. Go into the Windows folder and find the .lax file.

Open the file in a text editor and change this line

lax.nl.current.vm=

to

lax.nl.current.vm=[your path to java.exe]

If you are not sure where is your JDK installation, check your C:/Program Files (x86)/Java folder for a folder named like jdkx.x.x_xx. Open it and look for the bin folder inside, your java.exe should be inside. For example, my path would be:

lax.nl.current.vm=C:/Program Files (x86)/Java/jdk1.6.0_22/bin/java.exe

Save the file and run the .exe in the same folder (BlackBerryTabletSDK-Air-Installer-0.9.0.201010221500.exe) to start the installation.

If you do not have your JDK yet, get it at http://www.oracle.com/technetwork/java/javase/downloads/index.html

easySwap is now uSwap

The new version of easySwap (beta 2.0) is out! The NTU Student Union has volunteered to host it on their server (and provide the manpower to maintain it, so I had to change the name to uSwap as well, to be in line with their branding.

Find it at http://su.ntu.edu.sg/uswap

Unfortunately, I still did not have time to implement the other features that I had wanted to, especially the email notifications. High priority in my list is also to implement caching of the results so that it wouldn’t be so taxing on the server when the “refresh rate” is high.

Part of me also wanted to port the project over to plain html/php so that its supported on the iPhone/iPad (probably with jQTouch), but… that’s for next time.

Laggy Flash CS4? There’s an update to fix that

After suffering a laggy Flash CS4 for nearly 6 months, I finally decided maybe it was an issue with the software and not my file. I feel stupid for not considering this possibility – an update which fixes the problem have been existing for over a year now.

Download it at: Adobe Flash CS4 Professional Update (10.0.2)

30MB (140 for Mac) and doesn’t require a restart.