Flex 2 Metadata Tags

April 17, 2007

wddj51.jpg

My article on Flex 2 Metadata tags “Telling the Compiler how to Compile” is now available in the current issue of the Web Developer’s & Designer’s Journal. Check it out on pages 26 – 31. You can read it here.


Flickrin Apollo Tutorial

April 6, 2007

Flickrin is a real world application for searching photos online using Flickr API created by Ashwinee Kumar Dash. Currently in version 1.0, the user can do a basic keyword search for thumbnails.

flickrin.jpg

Link to tutorial:
http://flnotes.wordpress.com/2007/04/05/flickrin-ver-10-flex-flickr-apollo-mashup-tutorial/

Link to sources:
http://www.ashwineedash.com/download/Flickrin_1_src_files.zip

Link to application:
http://www.ashwineedash.com/download/flickrin1.0.zip


SnapIt Apollo – Source Included

March 26, 2007

I have had requests on how to take snap shot and save it to disk.  So here is a vary basic example that takes a picture of itself and saves it to disk using the file name provided.  Here is the guts of the function that saves the image:

snapit.jpg

private function snagPic():void {
bitmapData = new BitmapData(this.width,this.height);
bitmapData.draw(this,new Matrix());
var bitmap : Bitmap = new Bitmap(bitmapData);
var jpg:JPGEncoder = new JPGEncoder();
var ba:ByteArray = jpg.encode(bitmapData);
newImage = File.appStorageDirectory.resolve(“Images/” + fileName.text + “.jpg”);
fileStream = new FileStream();
fileStream.open(newImage, FileMode.UPDATE);
fileStream.writeBytes(ba);
}

Please note you will need the core lib for the image encoders if you want to compile it yourself.

Download the application

Download source code


Tutorials – Apollo (Community)

March 22, 2007

I have just added a new page for tutorials that have been made by the Apollo community. The 1st post is a tutorial on how to build an mp3 player with Flex and Apollo by Ashwinee Kumar Dash

Please visit this new page here.

If you have created tutorials and would like to have them posted, please contact me at rtretola@gmail.com


Apollo Online/Offline sample – full source included

March 21, 2007

Here is a nice little example of testing for online and offline within Apollo. It is very basic.

Test it by either hitting the Test Connection button or by pulling your cable on disconnecting your wireless.

Here is what is occurring within the application:

  • on creationComplete Shell.shell.addEventListener(Event.NETWORK_CHANGE,onNetworkChange);
  • onNetworkChange test the connection. Here is the contents of the test connection function.
    • var headRequest:URLRequest = new URLRequest();
      headRequest.method = “HEAD”;
      headRequest.url = “http://blog.everythingflex.com”;
      var response:URLLoader = new URLLoader(headRequest);
      response.addEventListener(HTTPStatusEvent.HTTP_STATUS,statusChanged);
      response.addEventListener(IOErrorEvent.IO_ERROR,error);
  • when the HTTPStatusEvent.HTTP_STATUS Event is broadcast statusChanged is called
    • The statusChanged fuction checks the status code and sets disconnected if code is 0
  • if IOErrorEvent.IO_ERROR is broadcast
    • we assume the connection is broken

Thats it. There are additional URLLoader events that can be checked but I haven’t included them in this example. Check the documentation for details on these events. Here is the results:

ONLINE:

online.jpg

OFFLINE:

offline.jpg

Download the application

Download source code