App inventor

Tonight I played with app inventor for android.
At the same time i got my new droid X.
Overall a good day.

About app inventor:
I gotta say, it’s pretty sweet.
Setup was a breeze.
The tool consists of two views: Fist is the app inventor. This is a browser based layout tool where you set up your UI and pick the visual and non-visual components.

The second part is the “block editor” where you do all of your wiring and make things work.

accelerometer block editor

acceleromter

Overall it’s pretty easy to get started and to understand. I can’t wait to see the creative things people come up with.

I decided to play with the accelerometer.

I was able to pretty easily and intuitively set up a view that displayed the different accelerometer properties in real time. I also added logic to count steps.

It was super easy to do. the packaged apk file is available for download here.

Playing with Rokon part 2

Playing around with more rokon examples.
I love it! the touch handlers are super simple to use. Rokon will definitely be a great way for me to get used to android. I continue to be impressed with how easy everything is to get going. I can say that with android in general.
I don’t feel somehow gimped like i did in iOS.
I’m looking forward to working with the accelerometer class.
After playing around for a bit I may create a tutorial on the accelerometer an give it to the rokon guys if they want to post it.

Playing with Rokon

Ok so rokon http://www.rokonandroid.com/ looks pretty cool.
Played with it a bit more and I’m really liking how it’s structured.
The whole inheritance chain is very reminiscent of DisplayObject. I like.

Animating is super simple, and slowly but surely , i am discovering the capabilities.
Good stuff! I’m almost done with the tutorials.

Android- getting things running on a Nexus One

Wow. it was incredibly easy.
I simply followed the instructions here http://developer.android.com/guide/developing/device.html and had a test app running on the phone in less than 10 minutes!

I am falling in love with android development.

Advanced load management

Flash advanced load management.

Loading and unloading swfs.

reseting swfs.

event propagation

event sandboxing.

memory cleanup.

maintaining state.

Automated Batch Compiling using FCSH, iFac and Ant

So I had a whole bunch of swfs that I needed to compile in a batch for my project.
I wanted to do this to ensure stability in my build releases for my flash project.
Also it’s a whole bunch of them and it’s a total pain in the butt to compile more than 10 files the way I had been doing it.

Up until this point I have been creating .launch config files and Running them as FDT AS3 applications. A neat little feature of FDT that uses the flex sdk’s fcsh compiler and a set of ANT tasks to compile a swf for you. You feed it your main class, the output directory, and presto! you have a compiled swf via fcsh.

This is cool and all except for one problem. You can only do one file at a time! A total pain to deal with when you have more than just a few files to compile. (My project has gotten quite large with many pages and many modules that need compilation) And again just to make sure that with each release i’m putting out the latest code I want to make sure everything gets compiled.

So I thought, OK, cool, I can just write an ANT build file that targets fcsh as the executable and strings together those .launch configs and boom! I’m done.
WRONG! I came to learn that fcsh basically terminates itself after executing a command. This is lame! Adobe needs to fix this.
Naturally after some interweb searching and a lot of frustration I came across this post on Adobe Labs which linked a few fcsh wrappers here:

http://labs.adobe.com/wiki/index.php/Talk:Flex_Compiler_Shell

What these fcsh wrappers do is that they essentially keep fcsh alive after you execute a command, allowing you to execute another command.

After researching and testing them all I ended up settling with iFac. It http://ifac-plugin.com/ but there was still a little bit of modifications I had to struggle with to get my batch compiling to work right. The example files the ifac guys post on their blog is only set up for one file, and it wasn’t super straight forward (at least for me) to set up an ANT build file that could handle.

Step 1:

Install iFac

Step 2:

Add a build folder at the root of your project. Create the following 2 files: build.xml and build.properties

Step 3:

Edit the .properties file

Step 4:

Edit the build file.

Step 5:

run as an ANT task!

Posting images to Tumblr

Pretty straight forward

package com.rga.nike.women.nfr.signupredesign {
import flash.display.Sprite;
import flash.events.*;
import flash.net.FileFilter;
import flash.net.FileReference;
import flash.net.URLRequest;
import flash.net.URLRequestMethod;
import flash.net.URLVariables;

/**
* Copied from adobe livedocs
*/
public class FileReferenceWrapper extends Sprite {
public static const ERROR : String = “error”;
private var uploadURL : URLRequest;
private var file : FileReference;
private var urlVars : URLVariables;

public function FileReferenceWrapper() {
uploadURL = new URLRequest();
uploadURL.url = “http://www.tumblr.com/api/write”;
uploadURL.method = URLRequestMethod.POST;
uploadURL.contentType = “multipart/form-data”; // not really supported.

urlVars = new URLVariables();

urlVars.email = ‘nelson.alexander@gmail.com’;
urlVars.password = ‘nelson’;
urlVars.type = ‘photo’;
urlVars.state = ‘submission’;
urlVars['private'] = ’1′;
uploadURL.data = urlVars;
file = new FileReference();
configureListeners(file);
}

public function browse() : void {
file.browse(getTypes());
}

private function configureListeners(dispatcher : IEventDispatcher) : void {
dispatcher.addEventListener(Event.CANCEL, cancelHandler);
dispatcher.addEventListener(Event.COMPLETE, completeHandler);
dispatcher.addEventListener(HTTPStatusEvent.HTTP_STATUS, httpStatusHandler);
dispatcher.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler);
dispatcher.addEventListener(Event.OPEN, openHandler);
dispatcher.addEventListener(ProgressEvent.PROGRESS, progressHandler);
dispatcher.addEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler);
dispatcher.addEventListener(Event.SELECT, selectHandler);
dispatcher.addEventListener(DataEvent.UPLOAD_COMPLETE_DATA, uploadCompleteDataHandler);
}

private function getTypes() : Array {
var allTypes : Array = new Array(getImageTypeFilter());
return allTypes;
}

private function getImageTypeFilter() : FileFilter {
return new FileFilter(“Images (*.jpg, *.jpeg, *.gif, *.png)”, “*.jpg;*.jpeg;*.gif;*.png”);
}

private function getTextTypeFilter() : FileFilter {
return new FileFilter(“Text Files (*.txt, *.rtf)”, “*.txt;*.rtf”);
}

private function cancelHandler(event : Event) : void {
trace(“cancelHandler: ” + event);
dispatchError();
}

private function dispatchError() : void {
}

private function completeHandler(event : Event) : void {
trace(“completeHandler: ” + event);
dispatchError();
}

private function uploadCompleteDataHandler(event : Event) : void {
trace(“uploadCompleteData: ” + event);
}

private function httpStatusHandler(event : HTTPStatusEvent) : void {
trace(“httpStatusHandler: ” + event);
}

private function ioErrorHandler(event : IOErrorEvent) : void {
trace(“ioErrorHandler: ” + event);
}

private function openHandler(event : Event) : void {
trace(“openHandler: ” + event);
}

private function progressHandler(event : ProgressEvent) : void {
var file : FileReference = FileReference(event.target);
trace(“progressHandler name=” + file.name + ” bytesLoaded=” + event.bytesLoaded + ” bytesTotal=” + event.bytesTotal);
}

private function securityErrorHandler(event : SecurityErrorEvent) : void {
trace(“securityErrorHandler: ” + event);
}

private function selectHandler(event : Event) : void {
var file : FileReference = FileReference(event.target);
trace(“selectHandler: name=” + file.name + ” URL=” + uploadURL.url);
file.upload(uploadURL, ‘data’);
}
}
}

Starlight

We are stardust harvesting starlight…

what we\’re doing today