Actionscript

Encounter with Kevin Hoyt and UMapper Demo on NexusOne

Posted in Actionscript, General, UMapper on April 14th, 2010 by andrei – Be the first to comment

Yesterday at NAB2010 I had a chance to catch up with Kevin Hoyt who is a platform evangelist at Adobe. In addition to all the cool new Flash CS5 features, Kevin showed the latest version of Adobe Flash Player 10.1 running on Google’s NexusOne. In the picture below Kevin is showing UMapper maps running on his Android phone.

UMapper map on NexusOne

I was very impressed with the quality and the speed of [mobile] maps and can’t wait to see this on my phone. As expected, Kevin didn’t share the release date for flash-enabled Android, but it should happen some time this year.

Packaging UMap API for IPhone

Posted in Actionscript, General, UMapper on March 8th, 2010 by andrei – Be the first to comment

Last week I finally had a chance to test UMap ( ActionScript 3.0 mapping API ) on IPhone. Aside from running into some minor issues with provisioning files, the entire process of packaging a Flash application for IPhone [in Flash CS5] went smoothly.

To my surprise I didn’t have to make any changes to UMap nor to my test application, the whole thing worked from the very first try. I was able to load KML files from UMapper, switch between map data providers (Bing, Yahoo, Google, OpenStreetMap), access IPhone’s GPS coordinates and use accelerometer. Here is a quick video demo – apologizies for the poor quality.

And here is the code that makes this work:

package  {
 
	import flash.display.MovieClip;
	import flash.events.Event;
	import flash.events.GeolocationEvent;
	import flash.sensors.Geolocation;
	import flash.display.Sprite;
 
	import com.afcomponents.umap.events.MapEvent;
	import com.afcomponents.umap.core.UMap;
	import com.afcomponents.umap.overlays.FeedLayer;
	import com.afcomponents.umap.overlays.Marker;
	import com.afcomponents.umap.types.LatLng;
	import flash.events.MouseEvent;
 
	public class IphoneMap extends MovieClip {
 
		private var _map:UMap;
		private var _feed:FeedLayer;
		private var _location:Geolocation;
		private var _count:Number=0;
 
		public function IphoneMap() 
		{
			createChildren();	
		}
 
		private function createChildren():void
		{
			_map = new UMap();
			_map.setSize(stage.stageWidth, stage.stageHeight-49);
			_map.doubleClickMode = "zoom";
 
			var tab_bg = new Sprite();
			tab_bg.graphics.beginFill(0x000000);
			tab_bg.graphics.drawRect(0,0,stage.stageWidth, 49);
			tab_bg.x = 0;
			tab_bg.y = stage.stageHeight-49;
 
			var map_btn:MapButton = new MapButton ();
			map_btn.x = 20;
			map_btn.y = tab_bg.y+ 10;
			map_btn.addEventListener(MouseEvent.CLICK, loadData);
 
			var target_btn:TargetButton = new TargetButton();
			target_btn.x = stage.stageWidth -( 20+target_btn.width);
			target_btn.y = tab_bg.y+10;
			target_btn.addEventListener(MouseEvent.CLICK, initLocation);
 
			this.addChild(tab_bg);
			this.addChild(target_btn);
			this.addChild(map_btn);
 
			this.addChild(_map);
		}
 
		function loadData(event:MouseEvent):void
		{
			_feed = new FeedLayer();
			_feed.autoShow = true;
			_map.addOverlay(_feed);
 
			var ids = ["57828","57823","57830"];
 
			_feed.load("http://umapper.s3.amazonaws.com/maps/kml/"+ids[_count]+".kml");
 
			if(_count==2){_count = 0;}else{_count ++;}
		}
 
		function initLocation(event:MouseEvent):void
		{
			_location = new Geolocation();
			_location.setRequestedUpdateInterval(5000);
			_location.addEventListener(GeolocationEvent.UPDATE, onLocationReceived);
		}
 
		function onLocationReceived(event:GeolocationEvent):void
		{
			_map.setCenter( new LatLng(event.latitude, event.longitude), 5);
 
		}
	}
}

Flash 10 and AIR on Mobile Devices

Posted in Actionscript, General on February 15th, 2010 by andrei – Be the first to comment

Yesterday Adobe made some important announcements that will have a huge impact on UMapper and other Flash-based platforms. It looks like Flash Player 10 and Adobe AIR will be [finally] supported on Android, Blackberry, Windows Mobile and other mobile platforms. Add to that Adobe’s IPhone packager and the entire smartphone vertical is covered, or at least will be by 2012.

Having played with Flash CS5 (mobile libraries and the new version of device central), I think Flash has a good shot at becoming a truly cross-platform (desktop, mobile, web) development solution.The fact that you can take an existing ActionScript code-base, adjust the UI and deploy it on a number of mobile devices (while maintaining a consistent user experience) will be a huge improvement. That said, Apple is still not supporting Flash and there is a risk that ‘packaged’ Flash IPhone applications will be limited.

I guess we will have to wait and see.

Flash CS5 and The Magic IPhone Packager

Posted in Actionscript, UMapper on February 10th, 2010 by andrei – 1 Comment

Today was my first day working with Flash CS5 and I loved it. Adobe finally added code completion and auto-import for the custom classes to the ActionScript editor. The code completion works for functions, events, properties and everything in between. Another cool improvement is the compiler error panel. You can now make more sense of the messages and switch between errors and warning. All and all, these changes significantly improve productivity and streamline the development process. Now to the big stuff.

It is true, you can compile Flash applications for the IPhone and it really works.

It works and it is quite simple. Adobe added libraries to handle location, accelerometer, multi-touch and other phone-specific features. To give you an idea here is how to capture GPS coodrinates of your device:

import flash.events.GeolocationEvent;
import flash.sensors.Geolocation;
 
var location:Geolocation = new Geolocation();
location.setRequestedUpdateInterval(1000);
location.addEventListener(GeolocationEvent.UPDATE, onLocationDataReceived);
 
function onLocationDataReceived(event:GeolocationEvent):void
{
// Here is your location data
trace(event.latitude);
trace(event.longitude);
}

To sum things up, I had a very good first impression, now is the time to test thing with a fully-featured location app.