Skip to content


Aquaria - iPhone Saltwater Aqarium Application

Well, after 2 weeks of being in review, my app Aquaria finally got approved. You can check out the details here:

http://www.uiappview.com/aquaria/

Share/Save/Bookmark

Posted in iPhone.

iPhone Saltwater Fish Compatibility Chart Application

More details of the "Aquaria" application

Please Note: To clarify, this application was written in Objective-C and not in Flash Actionscript. (I noticed there was a forum thread linking to this page thinking this app was built in Actionscript)

One of my hobbies is maintaining my reef aquarium. I remember being at the pet store wondering what impact a new fish would be to the current aquarium system. In my pursuit to learn more about building iPhone/iPod Touch applications and Objective-C I decided to build a simple application that would display the compatibility of one type of fish with another.

This project was interesting as it taught me more about the use of preference lists and being able to traverse the nodes of the .plist file. Here are some screenshots, and with some much needed testing on a real iPod Touch and iPhone I will soon push this to an app store. If by chance you are interested in saltwater aquariums and would like to help test this app, please let me know ( manewc [@] gmail )!

Share/Save/Bookmark

Posted in Objective-C, iPhone.

iPhone Laugh Track Application

There are many laugh track applications for the iPhone or iPod touch - so I decided to make this custom simple application. My friend was looking for one that has specific audio tracks that he had.. so Nellé here you go!

Share/Save/Bookmark

Posted in Objective-C, iPhone.

AIR Screenshot Applications

I know there are tons of AIR applications that will allow you to take a screenshot of a website, but I still wondered how this worked. Here is my first version, my only issue is that the image that is saved is only taking an image of what is visible within the viewable area. So, if the site’s bounds are larger than the application, then the image will get truncated… not sure what I need to do to fix this (scaling down?). Anyways, if any one knows I would be grateful for the help.

Here is my code:

<?xml version=”1.0″ encoding=”utf-8″?>

<mx:WindowedApplication xmlns:mx=”http://www.adobe.com/2006/mxml” layout=”absolute” width=”1024″ height=”768″>

<mx:Script>

<![CDATA[

import mx.controls.Alert;

/*

For the Web Browser

*/

private function showWebPage(url:String):void

{

var siteurl:String = new String;

if ( url == "http://" )

{

siteurl = "http://www.google.com";

}

else if ( url.search("http://") < 0)

{

siteurl = "http://" + url;

}

else

{

siteurl = url;

}

html.location = siteurl;

}

/*

For the Screen Capture

assistance: http://www.adobe.com/cfusion/communityengine/index.cfm?event=showdetails&productId=2&postId=8406

*/

import flash.display.BitmapData;

import mx.graphics.codec.JPEGEncoder; // encode to jpeg

private function openDialogue():void

{

var docsDir:File = File.documentsDirectory;

var f:File = new File( "/.jpg" );

try{

f.browseForSave("Save As");

f.addEventListener(Event.SELECT, saveData);

}

catch(e:Error)

{

trace(e.message);

}

}

private function saveData (e:Event):void

{

// take the snapshot

var bmpd:BitmapData = new BitmapData ( html.contentWidth, html.contentHeight );

// draw method public function draw(source, matrix, colorTransform, blendMode, clipRect, smoothing:Boolean = false

var drawRect:Rectangle = new Rectangle ( 0, 0, html.contentWidth, html.contentHeight );

bmpd.draw ( html,null,null,null,drawRect,false );

// encode bitmap data object to bytearray object so

// we can save it to a file

var jpgenc:JPEGEncoder = new JPEGEncoder(80); // 80 compression level

// encode the object

var imgba:ByteArray = jpgenc.encode( bmpd );

// now save it

//gets a reference to a new empty jpg image file in user desktop

var fl:File = e.target as File;

if (!fl.exists)

{

var stream:FileStream = new FileStream();

stream.open(fl, FileMode.WRITE);

stream.writeBytes(imgba);

stream.close();

}

}

]]>

</mx:Script>

<mx:HTML width=”100%” height=”100%” id=”html” x=”0″ y=”40″/>

<mx:TextInput x=”10″ y=”12″ text=”http://” width=”443″ id=”urlPage” />

<mx:Button x=”461″ y=”10″ label=”Go!” click=”showWebPage(urlPage.text)”/>

<mx:Button x=”705″ y=”10″ label=”Save Screen Capture” click=”openDialogue()”/>

</mx:WindowedApplication>

Share/Save/Bookmark

Posted in AIR.

Downloading Multiple Files with Flex 3 and AMFPHP

I originally was thinking that I would be able to do this by having the user select the files of their choice and click one button to download the items. So depending on their selection the Flex app would download the first item, then upon complete download of the first item it would download the second item and so on.. Unfortunately I could not get this to work on various browsers as the dialog box to download the file location would never appear on the second file. So with a little exploring I was able to accomplish the task of downloading multiple files of the users choosing with the use of:

Here is a list of things that I needed to get this working.

  1. AMFPHP - Lee Brimelow has an excellent tutorial to get you started: http://www.gotoandlearn.com/play?id=78
  2. PHP Class file to create zip documents from an array. You can find the one I used here: http://www.phpconcept.net/pclzip/index.en.php (note I am using PHP 5.*)
  3. I also grabbed this class file from FlexExamples.com for using a checkbox control as a list item renderer

Here is the process:

  1. So first the user will select the files he/she wishes to download
  2. The user will need to click a button to notify the server the array of files and generate a unique .zip document
  3. The download button will need to be active once the zip file is created so the user can then download the new .zip file
  4. User clicks the download button to download the file
  5. Will need to run a cron to delete all the generated .zip files as to not load up my server. (I won’t cover this step)

Honestly I am not a PHP programmer, but this is the Service Class that I put in my Service folder in my AMFPHP setup…

The file name is ZipFile.php (also don’t forget to inlude the library for zipping files)

<?php

class ZipFile
{
	/**
	* Demo ZipFile
	* @returns file name of zip object
	*/

	function ZipFileTest($fileArr) // this is what gets called from flash
	{
		// include the library from http://www.phpconcept.net/pclzip/index.en.php
		include_once("pclzip.lib.php");

		// create a unique file name.. this is prepended with manewc.com-
		$uniqueFileName = uniqid("manewc.com-");

		// create the zip
		$archive = new PclZip('../relative/path/to/put/this/zip/file'.$uniqueFileName.'.zip');

		$v_list = $archive->create($fileArr);

  		if ($v_list == 0) {
    		$status = "Error : ".$archive->errorInfo(true);
  		}
  		else
  		{
  			$status = $uniqueFileName;
  		}

		return $status;

	}
}

?$gt;

In Flex, I just need to add the ListItemValueObject.as file from FlexExamples.com. I added this file in src/com/flexexamples/.

Here is my Main.mxml file to create the ui:

Please note that my editor generally does not render my flex code properly.. check this file here: Main.mxml.txt




    
        
    
    

    
    
    

    
        
        
        
    

    

    
        
            
                
                    
                        
                            
                    
                
            
        
        
        
            
        
    

    


I’ll have to admit that this code needs to be cleaned up.. just ran out of time at the moment.

Share/Save/Bookmark

Posted in AMFPHP, Actionscript 3, Flex Web Development.