Posts Tagged ‘programming’

Mac OS X Mouse Wheel Support for ActionScript 3 Flash Applications (v.2+) (Hasseg)

Thursday, January 8th, 2009

[Editor's note: While Flash is great, sometimes it's omissions are vexing. Notable among them is true mouse wheel support on the Mac version of Flash player. Hasseg introduces a solution.] 

Republished from Hasseg. Originally posted there on April 26, 2008.

In my current job I have been programming user interfaces for applications that display networks of data (as in nodes, links etc.) with the Adobe Flex framework, and the UI paradigm I have been utilizing is a kind of a Zoomable User Interface (ZUI). The idea there is to enable the user to view and manipulate objects on a two-dimensional plane, and navigate around that plane by zooming and panning.

Now, the easiest way (at least for me) to control the zooming is to use the mouse wheel. Mouse wheel support for Flex is implemented by registering an event listener of type MouseEvent.MOUSE_WHEEL with the DisplayObject that would dispatch the event. Sadly, mouse wheel support is not available in the Mac OS X version of Flash Player. This prompted me to create a custom solution, as my main computer is a MacBook and I would like to be able to test the mouse wheel navigation with my development machine. . . .

So I’ve finally updated the solution I’ve made earlier for enabling Mac OS X mouse wheel support in Flex applications to a second version. I didn’t want to continue adding stuff into the original post, so I decided to write a separate post just for this new version. As you can see from the title, this version should work in any Flash project you’re writing in ActionScript 3, as opposed to just in Flex projects. This change was contributed by Pavel Fljot, and all the other stuff I’ve added since have been added on top of that. Deployment should now be a lot easier and some features that were missing in the first version have also been added.

Continue reading at Hasseg blog . . .

Privacy and GeoTagging Photos with GPS-enabled iPhone

Tuesday, July 29th, 2008

flickr geotag example map

Being able to record where a photo is taken one of the key features of the new iPhone. Not only does the phone capture a great picture but there is no residual “Now where was I”. You can instantly see where the photo was taken on a detailed map. This is great for geocoding when surveying, but what are the social implications?

Do you want to share this level of detailed personal information?

Why wouldn’t you? Consider this:

Upload a week’s worth of photos.

  • One taken on the way into work of that cute gal you always see at your metro station
  • Another in your office for a coworker’s going away party
  • Another taken at your favorite dance club
  • Another taken at the great brunch place you go to on Saturdays and
  • Another of the pile of laundry you’ve been ignoring all week

Normally you are adding captions and keywords that someone who already knows you can piece together and perhaps guess or already knows where all these physical places are. But you’ve gate-keeped based on “you need to know me and know enough about me” to get it.

Up until now, you’ve controlled the information flow based on how much you tag the photo in the context of how well your online “friends” know you.

Related links: adding GPS locations to photos when you don’t have a GPS (one) (two) (three) (four) (five).

GPS tagged photos are game changing

Now someone who doesn’t know anything about you, and with whom you might NOT want to share that level of personal information, can instantly become your first stalker. They know exactly where you live, exactly where you work, exactly how you get to work, and exactly where you relax and have let down your guard.

Something to consider as an adult and perhaps lock-down if your child has a GPS-enabled cell phone.

Of course, if you’re on a tourist trip and taking pictures of Yellowstone and the Statue of Liberty and are never going to be there again it’s perfectly fine to include the full GPS coordinates since that doesn’t disclose personal information and you’ll not routinely passing by there again. However, if you visit Aunt Mildred in Brooklyn on the same trip you might want to limit access to her home’s location.

I’m invincible, right? What do I care?

Consider the following two situations:

  • I was at a friend’s house party on Friday and took a few pictures and was about to post them when it hit me: I’m potentially compromising her safety, not just my own. If I post those GPS enabled photos some random person could view the photo (hey, it’s up on Flickr for anyone to browse) and know which front door to be waiting at. Skechadellic, dude!
  • I have a swimming hole I’d like to keep on the down-low but when I go out there I take a few shots with my camera to remember the scene. If I post those on Flickr with the GPS coordinates suddenly anyone that views my the photo tagged “My secret swimming hole” can see it placed exactly on that blue map polygon and route directly to it. Not so secret after all. Oops!

So it turns out Flickr has a way to moderate this to an extent. There is a setting to control this, sort of. Screenshot below:

flickr geotags

Notice how I do NOT have this option checked. But my GPS information is still being read in and placed on my account map somehow. Bad!

User Solution 1

The best, fail-proof option is to not record the GPS information when the photo was taken. But then you loose that information for your personal record. The iPhone asks the first time a GPS enabled application is launched if you want to allow it access to the GPS. Press “Don’t Allow” and you’re set.

But once you have enabled the camera to know the location you can’t disable it until the phone is turned completely off and restarted, less than convenient and oh so easy to forget about. You can go to the General Settings area of the phone and turn Location Service on and off without restarting the phone, however.

iphone use current location

User Solution 2

There should be a middle way when uploading and displaying on photo sharing sites like Flickr. This way you retrain full GPS location for your private records but only let out an approximate public location for everyone else.

For the Mac you can download PhotoInfoEditor to edit the precision of the GPS coordinates stored in the EXIF information for the photo (or a duplicate targeted for public upload). I had a devil of a time finding this app as most simply report the GPS coordinates; they do not allow them to be edited. If someone knows of a comparable app on the PC please email me.

Notice in the screenshot below that I have stripped the latitude and longitude to display to the hundredth (39.35° N). You could just as well scramble the coordinates down to the 4th or 5th decimal position when in the city and still be in the right neighborhood but no longer be at the right building. Photosets can be batched adjusted.

This puts the photo in the rough vicinity of the actual location but does not reveal the actual location

. photo info editor screenshot

When you do this before uploading to Flickr or Picasa you can have the benefit of placing your photos on a map with some accuracy but just not with a high precision. In other words, don’t zoom too far into the map or the photo locations become inaccurate. But zoomed out they are perfectly acceptable.

How can software be improved?

On upload / display of the photos in a social photo site:

  • Group permissions for viewing Placename tags and GPS coordinates on map with default being NOT to show the geographic location but to apply limits of precision with individual photo exceptions as detailed next:
  • On / off toggle for Placename tags per photo
  • On / off toggle for GPS coordinates per photo
  • Placename precision (country, state, county, town, neighborhood) from Yahoo or Google geocoder as a slider control per photo
  • GPS precision (exact, 1/4 mile, 1/2 mile, 1 mile, 2 mile, 5 miles, 10 miles, 20 miles, 60 miles) for latitude and longitude as a slider per photo

The GPS precision needs to take into consideration that the number of earth miles at each degree of latitude changes. Simply chopping of decimal places is a crude solution. A more elegant solution would be to add a random ± X decimal degrees to the actual location at the target precision. Even though the iPhone GPS can get you down to 10 meter accuracy, sometimes you don’t want to be that precise.

I’ve already spoken to the developer at AirMe which is my favorite app on the iPhone for uploading to Flickr and he seems interested in making the required upgrades to his application. Please help spread the word to other developers!

ActionScript 2.0 to ActionScript 3.0 Migration (Flashcoder)

Monday, July 28th, 2008

[Editor's note: I'm just getting the hang of AS2 and now it's time to learn AS3 to take advantage of the speed optimizations and new features only available in AS3 like the Google Maps Flash Component. The languages are just enough different yet the same to be a pain. This tip sheet should ease the transition.]

Republished from Flashcoder.cn.

Full list there in a prettier graphic design table format. Example below, partial for the MovieClip class. Hyperlink goes to Adobe documentation for property.

AS2 MovieClip Class
AS3 flash.display.MovieClip

Note: Many of the MovieClip methods have been moved to other
classes in AS3. All event handlers have been replaced by event objects in
the new event model.

_alpha Property
flash.display.DisplayObject.alpha
Moved to DisplayObject class. Initial underscore in name
removed.

blendMode Property
flash.display.DisplayObject.blendMode

cacheAsBitmap Property
flash.display.DisplayObject.cacheAsBitmap

_currentframe Property[read-only]
flash.display.MovieClip.currentFrame
Initial underscore in name removed.

_droptarget Property[read-only]
flash.display.Sprite.dropTarget
Moved to Sprite class, initial underscore removed from
name, and changed to CamelCase.

enabled Property
flash.display.Sprite.enabled
Moved to Sprite class.

filters Property
flash.display.DisplayObject.filters

focusEnabled
Property Removed.

_focusrect Property
flash.display.InteractiveObject.focusRect
Moved to InteractiveObject class, removed initial
underscore from name, and changed to use camelCase.

_framesloaded Property[read-only]
flash.display.MovieClip.framesLoaded
Removed initial underscore from name, and changed to use
camelCase.

_height Property
flash.display.DisplayObject.height
Moved to DisplayObject class, removed initial underscore.

_highquality Property
Removed.hitArea Property
flash.display.Sprite.hitArea
Moved to Sprite class.

_lockroot Property
Removed.

menu Property
Removed.

_name Property
flash.display.DisplayObject.name
Moved to DisplayObject class. Removed initial underscore
from name.

opaqueBackground Property
flash.display.DisplayObject.opaqueBackground

_parent Property
flash.display.DisplayObject.parent
Moved to DisplayObject class. Removed initial underscore
from name.

_quality Property
flash.display.Stage.quality

_rotation Property
flash.display.DisplayObject.rotation
Moved to DisplayObject class. Removed initial underscore
from name.

scale9Grid Property
flash.display.DisplayObject.scale9Grid

scrollRect Property
flash.display.DisplayObject.scrollRect
Changed to data type Rectangle.

_soundbuftime Property
flash.media.Sound.soundBufferTime
Moved to Sound class, and renamed to full wording without
initial underscore.

tabChildren Property
flash.display.DisplayObjectContainer.tabChildren

tabEnabled Property
flash.display.InteractiveObject.tabEnabled

_target Property[read-only]
Removed.

_totalframes Property[read-only]
flash.display.MovieClip.totalFrames
Removed initial underscore and changed capitalization.

trackAsMenu Property
flash.display.MovieClip.trackAsMenu

transform Property
flash.display.DisplayObject.transform

_url Property[read-only]
flash.net.URLRequest.url

useHandCursor Property
flash.display.Sprite.useHandCursor

_visible Property
flash.display.DisplayObject.visible
Moved to DisplayObject class and removed initial underscore
from name.

_width Property
flash.display.DisplayObject.width
Moved to DisplayObject class and removed initial underscore
from name.

_x Property
flash.display.DisplayObject.x
Moved to DisplayObject class and removed initial underscore
from name.

_xmouse Property[read-only]
flash.display.DisplayObject.mouseX
Moved to DisplayObject class, changed name to mouseX and
removed initial underscore from name.

_xscale Property
flash.display.DisplayObject.scaleX
Moved to DisplayObject class, changed name to scaleX and
removed initial underscore from name.

Land Contracts, Sales Go To Johnson Associates (Kelso via TWP)

Sunday, July 6th, 2008

[Editor’s note: This is my third map that refines the mashup template I’ve been developing for The Washington Post. Data is loaded via XML so the producer doesn’t need to edit the HTML. Option to enable the auto-generated legend below the map (the pop-menu above the map is part of the “legend”). MouseOver tooltip behavior tells the user what the markers are called before they click on them to get full details. Option to zoom in on marker click and get satellite map when the info window is called up.

My favorite feature: on close of the information window that resulted from that marker click the map pans / zooms back to it’s prior location. No more “where was I” moments so common with mashups! Goes with an investigative piece, read that here.

WEB EDITOR: Juana Summers — washingtonpost.com. REPORTERS: Cheryl W. Thompson and Mary Pat Flaherty — The Washington Post. Interactive by Nathaniel V. Kelso — The Washington Post. First published June 6, 2008.]

Since County Executive Jack B. Johnson took office in December 2002, his administration has agreed at least 11 times to sell public land to people with ties to Johnson, including a former business partner, a current business partner and several campaign contributors. Johnson said he has not been involved in awarding any of the contracts and has ordered a review of county procedures for selling public land. Those who won the deals said they were not given special treatment. The projects are mapped below.

Interactive graphic mirrored below. Original available here.