Posts Tagged ‘flex’

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 . . .

How to Script in Adobe Illustrator (Adobe)

Wednesday, January 7th, 2009

[Editor’s note: I get asked frequently how to get into automating Illustrator via scripting. My favorite language is JavaScript (it’s cross platform) but there is also AppleScript (Mac) and Visual Basic (PC). A listing of all my scripts is here, including my recent script for creating calendars. Adobe does a good job of getting you started with several introductory and intermediate manuals. Plus they even offer a free toolkit application for writing the JavaScripts. The new scripting guides for CS4 are up on Adobe’s site, including how to use Flash panel inside Illustrator to make more interesting graphical user interfaces (or hit testing). There’s new information on using TabStops in there over CS3 and documentation on how to script the new Artboards feature. Give it a try!]

Republished from Adobe.com.

ADOBE ILLUSTRATOR CS4 SCRIPTING

A script is a series of commands that tells Illustrator to perform one or more tasks. Adobe Illustrator CS4 supports scripts written in AppleScript, JavaScript or VBScript. Sample scripts are included in the Adobe Illustrator CS4 installer and get installed with the product. The latest available scripting documentation is provided below:

SAMPLES

Adobe Illustrator CS3 FlashPanel Sample

The FlashPanel sample for Adobe Illustrator CS3 shows how to script Illustrator from Flash using ScriptUI’s FlashPlayer control. The sample illustrates how rich user interfaces created by Flash authoring tools such as Adobe Flex Builder 2 can interact with Illustrator’s scripting object model.

Want to track Adobe Flash? Now you can! (Google)

Monday, November 24th, 2008

[Editor's note: Google releases AS3 classes and components for Flash and Flex IDEs to allow easy and professional tracking within SWF files at the same level of service as the earlier Javascript based tracking code base for normal HTML pages. Better understand how your Flash movies are actually used.]

Republished from Google.com, original 17 Nov. 2008.

Image of Analytics Flash Visual Component in Flash CS3

Today, at the Adobe MAX Conference in San Francisco, in a joint collaboration with our friends at Adobe and a few ace third party developers, we announced a simplified solution for tracking Flash content for everyone, called Google Analytics Tracking For Adobe Flash.

Working at Google over the past couple of years, I’ve had the opportunity to work with with many of our top clients to implement Google Analytics, who have found the power to identify and analyze trends on their web sites highly useful. But, one of the most common implementation challenges has been tracking Flash content on their pages. In the past, Flash tracking was not provided out of the box, and every implementation had to be customized. Moreover, there was a lack of standards, and new developers who tracked Flash had to create their own processes to get it working. With this launch, tracking your Flash content has never been simpler.

What It’s All About
This feature is a translation of the current Google Analytics tracking code into the ActionScript 3 programming language that dramatically simplifies the ability to track Flash, Flex and AS3 content. This new Flash tracking code provides all the rich features of the current JavaScript-based version, including campaign, pageview and event tracking and can be used to track Flash content such as embedded videos, branded microsites and distributed widgets, such as online games.

Now it’s simple for Flash content developers to answer questions like:

  • How many people have watched my video?
  • Are we developing the right creative that attracts new users?
  • How effective is my content at getting people to take action?
Recently, we talked with Matthew McNeely, VP of Engineering at Sprout, a company that helps advertisers design rich media content, about how Sprout has used the code to track distributed content across MySpace and iGoogle:

Supported Platforms
We know there are many levels of experience in the Flash/Flex community so we tried to make it easy for both non-technical designers as well as seasoned ActionScript programmers to take full advantage of this Google Analytics Tracking For Flash. We’ve provided tracking libraries for both Flash and Flex which can be downloaded as a ZIP file here. The libraries include:

  • Flash visual component
  • Flash AS3 library
  • Flex MXML component
  • Flex AS3 library

And you can learn more about how to use them through this developer documentation.

Open Development
At the same time, we know that things change quickly online, and developers might want to review and improve the code. So we’re providing our entire AS3 code base under the Apache 2 License as Open Source, available here.

For me, this is one of the most exciting aspects of this project. If you are a developer and want to improve the code’s functionality, you can contribute to the code base. Or, if you are a company that is running a content platform, such as Sprout mentioned above, you can seamlessly integrate the Flash tracking codebase into your existing architecture.

So while many features get launched at the end of their development cycle, we see this as just the beginning.

And A Special Thanks
This feature has been an open collaboration of a number of very talented people across the globe. We’d like to personally thank our amazing third party developers Zwetan Kjukov and Marc Alcaraz who’ve spent countless hours developing the code base. We’d also like to thank Matt Chotin, Puneet Goel, Rani Kumar and Ajit Gosavi from Adobe who helped us also overcome the obstacles of migrating to an all-AS3 environment.

So please visit the project page to learn more:
http://code.google.com/p/gaforflash/

We look forward to hearing success stories about how you’ve implemented Google Analytics Tracking For Adobe Flash!

Collision Detection Kit in AS3 (lessthanthree)

Tuesday, November 18th, 2008

Collision Detection Kit: Pixel-precise, shape-based collision detection for ActionScript 3.0

Republished from the Google Code page.
Download the source code here.

The Collision Detection Kit is a package of classes created for pixel-precise, shape-based collision detection for all display objects. It is written in Actionscript 3.0 and meant for Flash Player version 9 and higher. The Collision Detection Kit comes with several features to control how collisions are detected, and provides data for the user of the class so they can do something about the collision:

  • Set an alpha threshold to ignore colors below the threshold.
  • Specify colors and color ranges to exclude from collision detection.
  • Receive an angle of collision for each collision. We’re not talking about bounding boxes here – the angle is calculated based on the shapes of the display objects at the site of the collision. Great for when you’re working with physics!
  • Receive the amount of overlapping pixels between colliding objects. Combined with the returned angle, and your physics engine will have no problems traversing complicated shapes.
  • Takes transformations (scale, rotation, color transforms, etc.) of individual instances of your display objects into account.
  • Add items for collision detection regardless of their nesting.
  • You can have as many CollisionGroup and CollisionList instances as you want, allowing you to easily manage different interactions and behaviors.
  • Works with all display objects – MovieClips, Sprites, Bitmaps, TextFields, FLVs, and on and on!

To learn more about this package and how to use it, please reference the links for examples and documentation.

New Web 2.0 APIs Make GIS Access and Integration Capability Available to Everyone (ESRI ArcNews)

Thursday, November 13th, 2008

[Editor's note: 2 of 2 articles of note from the Fall 2008 ESRI ArcNews magazine. This about new ArcGIS web 2.0 API services for JavaScript and Flex / Actionscript / MXML allow Google Maps style mashups. Includes informative podcast.]

Republished from ESRI ArcNews.

ArcGIS Server 9.3 Radically Simplifies Users’ Experience

click to enlarge An executive dashboard mashup created with ArcGIS Server that provides city staff the ability to monitor the status of capital improvements, 311 calls, and police patrols.

With the release of ArcGIS 9.3, ESRI provides a new set of application programming interfaces (APIs) that extend the range of what developers can do with mashups. These APIs give mashup developers more opportunities to rapidly build lightweight, focused applications on top of ArcGIS Server using JavaScript, Flex, Silverlight, and many other scripting languages. As a result, organizations can begin deploying an entirely new pattern of mashups, which involves combining internal and external data sources to create an application that solves a particular problem. These mashups more closely match the types of relationships, workflows, and administration developers need to support on a daily basis.

GIS-powered mashups empower users to solve real problems by incorporating the business knowledge and resource investments made by the organization and putting it in the hands of the decision makers and analysts who need to rely on trusted information. For example, a city government might build a mashup that focuses on vacant properties or brownfields to support community planning and economic development. In this case, parcel data might be combined with tools to analyze the development potential of a property based on different scenarios. The tools would appear as a simple button or drop-down menu of choices but, when executed, would access internally hosted information, such as zoning, crime, and infrastructure, and perform server-side analytics on the GIS server. The user would be presented with a hot spot or graduated-color map highlighting the areas that best met the selected criteria. This type of mashup could be used at the front counter or on the desk of an economic development specialist to help engage business and industry owners interested in moving their operation to the community. It would provide access to authoritative data not readily available on the Internet.

click to enlarge ArcGIS Server offers a rich set of tools to build lightweight Web applications.

Until recently, mashups have been thought of as Web applications that aggregate data feeds from multiple Web services into a simple and often social or consumer-oriented Web application. Mapping mashups show the locations of points of interest generated from available services and GeoRSS feeds that contain spatial information, such as addresses or coordinates. Now, organizations are adopting the concept that mashups can be useful for conducting business and providing critical functionality to their users and business partners either over the Web or through internal distribution. Enterprise systems, like customer relationship management (CRM) or asset management systems, can be coupled with ArcGIS Server services to provide business and government managers and analysts with unique access to their authoritative knowledge bases. This means that an enterprise mashup must efficiently and seamlessly blend the GIS platform with the organization’s underlying systems architecture.

ArcGIS Server gives organizations the ability to manage and deploy Web services for mapping, data management, and geospatial analytics. These ArcGIS Server Web services allow organizations to leverage their internal GIS resources, as well as services hosted on other GIS servers, and put them to work in enterprise mashups. Because ArcGIS Server is built on industry and Web standards to support service-oriented architectures (SOAs) and hundreds of data formats, organizations are provided with an integration platform for creating and managing enterprise mashups.

In-depth description of the JavaScript and Flex APIs and podcast links on the next page…

(more…)

GBIF data heat maps – Heat maps over Google Maps for Flash (Biodivertido)

Wednesday, September 3rd, 2008

[Editor’s note: Fascinating proof-of-concept for how to create and display heat-maps in Google Maps for Flash/Flex AS3 using PHP back-end for calculation and Flash for front-end. More information for using Google Maps in Flash CS3 download and reference and tutorial. Similar to some nifty work Zach Johnson is working up at Universal Mind for spatialkey.com.]

Reprinted from Biodivertido.

Maps like everything else seems to be trendy. And nowadays the sexy thing in mapping is the creation of Heat Maps. The best way to understand what they are is to see them:

You can also take a look at this post from one of my favorite blogs on what is and what is not a heat map.
Well for long time I wanted to give it a try and yesterday I had the time to experiment a bit. The idea was to display GBIF available data as a Heat Map over Google Maps. Here you have an screenshot for Quercus ilex:
And if you want to try for yourself here it is (some usability issue, the search box is on the bottom right corner):
So how does it work? It was actually easier than I expected:
1) Get the data: I am using the so called “Density tables” from GBIF. You can access them through GBIF web services API at http://es.mirror.gbif.org/ws/rest/density . For example in a query like this one for Quercus ilex (of course you need to get the taxonconceptkey from a previous request to the services): 
This works fine but has some problems. The first one is that GBIF goes down almost every evening. Tim can maybe explain why. Thats why I am using the spanish mirror (look at the url) and I recommend you to do the same.
Second problem is the verbosity of the XML schema being used. For downloading the Animalia, well thats the biggest concept you can get probably, the result is 14.1 MB of XML. And thats just to get a list of cellIds (if anybody is interested we can post details about CellIds) with counts on them, exactly an array of 34,871 numbers. Even worst is handling them on a web client like this one, parsing such a huge xml output kills the browser. The GBIF webservices API deserve its own blog post I would say together with Tim.
But what is new is that I have supercow powers on GBIF :D I am working for GBIF right now and have access to a test database. In a testing environment I developed a little server app that publish the same density service but using theAMF protocol. I used AMFPHP for this if anybody is interested. There are two good things about using AMF: The output now is around 150 KB for the same thing and AMF is natively supported by Flash so there is no need to be parsed it goes straight into memory as AS3 Objects.
2) Create a Het Map from the data: Once the data is on the client I make use of a Class from Jordi Boggiano called HeatMap.as that creates Sprites as the result. In my case I decided to create a Spring, think like an Image, of 1 pixel per cellId creating a 360×180 pixel image (cellId is equivalent to a 1 degree box).
3) Overlay the image on Google Maps: When you have the Sprite, or even earlier but thats too many details, what you do is overlaying in Google Maps for Flash using a GroundOverlay object that takes care of the reprojection and adapting it to the map. The GroundOverlay is explained in the doc as a way to overlay images but it accepts actually any Sprite.
Done! (almost)
4) Ok, there are some problems: Yes, it is not perfect, these are the pending issues:
  • The GroundOverlay seems to not be reprojecting correctly the Sprite I generate and in the very north and south everything is not correctly overlayed.
  • The resolution of the Heat Map is a little bit poor, bu actually represent the quality of the data we have. Some interpolation could be done to make it look nicer.
  • The colours of the Heat Map do not fit well with the actual Google Maps layers. When there is small data then you can not see it almost.
I still dont feel confident with the code to release it yet. I hope I can work a little bit more on it so that i can be proud, but if you desperately need it let me know.
Just another notice. Yesterday Universal Mind released a preview of a new product: Spatial Key. I am always impressed with what this people does and follow the blogs from their developers (like this one and this one). They are kind of my RIA and web GIS heroes. The new product they have released actually look very much like what I wanted to do in Biodiversity Atlas for data anlysis. It lets people explore geographically and temporally huge datasets. Tim suggested me to contact them and I will do. Nevertheless it is great to have such a great tool available to get ideas on interaction design. Good job Universal Mind, you really rock.
We want to see your comments!
Update: 
Some people asked for different quality settings on the heat map. I have modified the application so that you get now a set of controls to define different quality and drawing options. By default the app tries to figure out depending on the number of occurrences, but maybe thats not the best, depends on how the data is dsitributed. In a final product I think I would NOT provide this functionality to the user, too much for my taste. You know, less is more.

Using Google Maps to Visualize ArcGIS Data & Services (Google Geo Dev. Blog)

Wednesday, September 3rd, 2008

[Editor's note: This blog joint blog post from ESRI and Google has examples on how to integrate the new 9.4 features with Google Maps Mashups. This includes all the power of GIS geo-processing leveraged into the Mashup environment. I hope this trend continues with the promised release of a Flash/Flex API for ArcGIS.]

Reprinted from Google Geo Developers Blog. Tuesday, August 12, 2008

Hi, I’m Sterling Quinn and I work on the development team for server-based GIS technologies at ESRI in Redlands, California. We’re happy to report that ESRI software users can now expose their GIS in Google Maps through the recently-released ArcGIS JavaScript Extension for the Google Maps API. The extension is built on the Google Maps API and is designed to communicate with ArcGIS Server, ESRI’s product for serving GIS functionality on the Web.

The ArcGIS JavaScript Extension for the Google Maps API allows you to maintain the user-friendly front end of Google Maps while tapping into an advanced GIS on the back end. You can use the extension to display your own maps on top of Google’s, query features in your database and display them on the map, or expose tasks that run GIS analysis models on the server. You can display your results using the Google Maps API’s native graphics engine and info windows.

To learn how to use the ArcGIS JavaScript Extension for the Google Maps API, use the online SDK, which contains basic concepts, an API reference, and examples of how to create custom maps and Mapplets. The examples contain detailed descriptions on how to do things like adding an ArcGIS Server map type button,displaying query results as KML, or running a task on the server to return a route and elevation profile.

Following are some quick links to example Mapplets built with the ArcGIS JavaScript Extension for the Google Maps API. For those of you who don’t know, Mapplets are mini applications that you can add to Google Maps in the “My Maps” tab and are nifty because a user can enable multiple Mapplets at a time.

Cached Map ServiceDisplays an ArcGIS tiled map service over the Google base map.

Census Block QueryRetrieves US Census data from an ArcGIS map service at a point you click and displays it in a series of charts created with the Google Chart API.

Message in a BottleUses an ArcGIS geoprocessing service to tell you where a bottle would drift if you dropped it in the ocean.

Service Area AnalysisUses an ArcGIS geoprocessing service to display drive time polygons from a point you click.

Using Google Maps in Flash Without Flex (Ideaography)

Tuesday, July 22nd, 2008

Republished from Ideaography.  July 19th, 2008

I was excited at first when I heard the news that google had released an googlemaps api for flash/flex, but found out it was a little misleading since the flash sdk is only supported through flex. Problem for me is,  all of my projects as purely flash based without the need of the flex framework.

After and hour or so of searching, I finally found a version through the “google maps api for flash” google groups at http://groups.google.com/group/google-maps-api-for-flash/files (grab the latest file, at the moment its 1.5) that can be used in the flash development environment.

Before it can be used, you need to copy it to the “Adobe Flash CS3 – en – Configuration – Components” directory under the flash cs3 folder on your hard drive. [Editor's note: You must have at least version CS3 to use this component.]

To use it, open the components panel in flash and drag the googlemaps component to the library and not the stage. From there, just import the classes and methods you need as outlined in the google maps  documentation. http://code.google.com/apis/maps/documentation/flash/reference.html

Also remember in order to get it working, you need to Sign up for a Google Maps API Key and replace the apiKey variable in the example below.

Google maps example in flash – Here’s a very simple example of how to embed googlemaps using the method above.

Newsflash! ESRI to best Google Maps with Mashup Capability

Monday, May 12th, 2008

(Reprinted from flex888.com. View original post.)

Finally, GeoWeb is Complete and Born

Posted by Moxie | March 19, 2008 .

What’s is the best RIA application ever created? If your answer is something aroundFlex or Flash, then it’ll be wrong answer. The right answer is Google Map. It’s Google Map makes AJAX known and RIA a reality. Google even goes above and beyond claimed the term “GeoWeb“. However, up till now, Google Map is still just the best client, the visualization end, of GeoWeb. The “Geo” part of GeoWeb was missing.

Yesterday, ESRI, the shy, but true and real “Geo” dude behind all, I mean ALL, the web map buzz and technologies, released its very own JavaScript API and REST based Geo Process services to the world. The GeoWeb is finally complete and born.

The JavaScript API has three parts, the ESRI JavaScript API, the Google Map extension, the Virtual Earth extension. That means you can use the top three GeoWeb clients with this simple API to do the real “Geo” things.

What is the “Geo” things and why it’s a big deal to GeoWeb?

Well, everyone and his/her grandma knows what Google Map does, plans the trip and shows locations. What’s the most mashed up platform? Google Map. What 99% Google Map mashup applications do? Put pins (markers) on the map? But what if we want to ask some questions beyond the pushpins:

  • Within 5 minutes driving time, show me the areas that I can reach. Don’t fool me with a circle. That is cheating. Because there might be highway, service street, or river among the 5 minutes driving range. The area you can cover by driving is a irregular polygon. But how do you get that polygon drawn on the map to show the 5 minute driving range?
  • Three of my friends want to meet for lunch. We want to meet at a Starbucks where everybody has the least driving time to get there. Fair enough? But how do you quickly give me that Starbucks location and provide driving direction for each of us.

The questions can go on and on. How these questions are answered? Through a thing called Geoprocessing, which is provided by the technology called GIS (geographic information system). But why you’ve never heard of it and it’s not well known in the Web 2.0 space? That’s because it’s a very hard nut to crack and only a few dudes know how to do it inside out. ESRI is the one does it the best, and now, it gets everything figured it out. The whole web can have it.

If I tell you, with three lines of JavaScript codes, plus some regular JavaScript programming you can easily answer the above question visually on either ESRI map, Google Map or Earth Map. Do you believe me?

You don’t have to because I’ll show you how.

First Line:

    var map = new esri.Map(“mapDiv”, { extent: startExtent });

Looks familiar, isn’t it. Indeed, it’s just like Google Map or Virtual Earth API.

Second Line:

    var streetMap = new esri.layers.ArcGISTiledMapServiceLayer
(“http://server.arcgisonline.com/ArcGIS/rest/services/
ESRI_StreetMap_World_2D/MapServer”);

Something new here. Well, if you head to ArcGIS Online, a free gwoweb resource from ESRI, you would find out there are lots of good free base maps you can choose. Or, you can use any map published to a ArcGIS Server. It’s long story here for those map publishing goodies, I’ll tell you later, piece by piece. But just you know this line of code gives you a whole big world of maps to works with. Just remembering that is enough for now.

Third Line:

var gp = new esri.tasks.Geoprocessor
(“http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/
Network/ESRI_DriveTime_US/ GPServer/CreateDriveTimePolygons”);

This is “Geo” part of the GeoWeb. One line, it consumes a geoprocess, in this case, a services called CreateDriveTimePolygons. This geoprocess called is actually via REST API (as the URL reveals) . The returned result can be in JSON, KML or XML. That means you really don’t have to use this JavaScript API. As matter of fact, I do have Perl or PHPexamples consume the very same gepprocess, but that’ll be another post.

The rest code is really just parse the result and draw the polygon on the map. If you know Google Map API, there are no surprises there.

The following is the true GeoWeb application I’ve introduced to you. You can zoom in to any city just like you would do with gmap (scrolling mouse, drag the map, etc.). Then click the map. The 1, 3 and 5 minutes driving time polygon will be shown.

Click Here to Run the Application (view source for detail code).

I will post another example to solve that other problem using Flex. Stay tuned.