Archive for the ‘ActionScript’ Category

September 3, 2010 0

Google Maps API for 2 Domains (in Flash, AS3)

By Karey in ActionScript, Application, Flash, Web

Google Maps can be easily integrated into Flash with an API key for the application's domain. Though, since each Google Maps API key can only be assigned to one domain, if your website contains two domains reading the same server (example: www.mysite.com and www.mysite.org), you will need two separate API keys for each domain. While ideally I'd prefer to redirect one domain to the other, this isn't always the case for how a client wants their site to read. In order for the SWF file containing Google Maps to load successfully in multiple domains, the ActionScript file needs to be edited accordingly. Though the final result can also be achieved using a combination of JavaScript and ExternalInterface in Flash, I found it easiest to use AS3's LocalConnection to convert the SWF's domain into a String and then indexed with an if/else statement to decide with API key ActionScript should use:

 
import flash.net.LocalConnection;
var lc:LocalConnection = new LocalConnection();
var domain:String = lc.domain;
 
if (domain.indexOf("com") != -1) {
	map.key = "key-A";
} else {
	map.key = "key-B";
}
 
map.setSize(new Point(P1, P2));
map.addEventListener(MapEvent.MAP_READY, onMapReady);
swfMovieClip.addChild(map);
 

More information on Google Maps API.

August 15, 2010 0

AS3, XML, CDATA – <strong> instead of <b>

By Karey in ActionScript, Flash, XML

With a recent Flash project, I was struggling to find a solution to display bolded HTML text from XML files that uses the <strong> tag. The reason I wanted to use <strong> instead of <b> was because the XMLs were being generated from MODx content management system. Since Flash cannot read the <strong> tag, I used the RegExp class in AS3 to find and replace <b> with <strong> in the XML content text before sending it to my htmlText in Flash to read. Below is the snippet of code is used:

 
var myPattern:RegExp = /strong/g;
var str:String = xml.content.toString();
contentTxt.htmlText = str.replace(myPattern, "b");
 

Though a simple solution, took me awhile a bit of research to arrive at the above conclusion. Therefore hope this saves some time for others!

August 7, 2010 0

Google Mashups and Flash (AS3)

By Karey in ActionScript, Application, Flash, Resource

I recently learned about Google Mashups from my boyfriend who relayed class material from his MS in Management of IT program, and luckily with perfect timing in relation to current projects. Essentially, Google Mashups can be defined as a web page or application that combines data or functionality from two or more external sources, resulting in a new service. For example, a Mashup can be created by integrating Google Maps into a personal web page, combining web page information with map data.

Two weeks ago I launched the website for Monticello Wine Trail, in which I utilized Google Mashups. One of the most important aspects of the MWT website is the ability for visitors to view and learn about the smaller trail clusters of wineries, grouped by their proximity to one another. In the previous website, the trail information was provided on a static JPG image. By integrating Google Maps into the Flash site, website visitors are able to interact (zoom and pan) with the maps, providing an overall more interactive user experience and more detailed map information.

google-mashups-api

Integrating Google Maps into Flash (via ActionScript 3.0) is quite easy and only requires the use of Google Maps API (which allows embedding of a Google Map into one's web page using JavaScript). The following link walks through the steps for embedding Google Maps in Flash applications. Google also provides tutorials and a great selection of Flash and Flex demos from which to pull code.

Below are some links to additional resources:
Sign Up for the Google Maps API
Displaying Google Maps in Flash by Kirupa
Implement a Map Using the Google Map API for Flash by Activetuts+
Google Maps: 100+ Best Tools and Mashups by Mashable

July 8, 2010 0

Arnaud Icard & AS3

By Karey in ActionScript, Flash, Resource

icard-01

Secretly hoping my work slows down soon so I can test out Arnaud Icard's ActionScript 3.0 experiments posted on his blog. Code libraries include a cloth simulation built with Traer.physics port to AS3 (second image, link), a simple gesture recognition engine (top image, link), and 3D grass experiment with stitching sprite instances together seamlessly (third image, link). Wow.

(more...)

June 23, 2010 0

Bernat Fortet

By Karey in ActionScript, Computer Graphics, Design, Photography

Digging the work of digital creative Bernat Fortet. Most of his work focusing on CG and Graphic Design, though I prefer his Flash experiments and photography (an example of each below). Be sure to check out the independent NodalGenesis project site to test out Bernat's interactive generative Flash artwork.

NodalGenesis (Flash)
Bernat-Fortet-01

NYC-Philly Veggies (Photography)
Bernat-Fortet-02

Bernat Fortet

June 13, 2010 0

Kinetic Sketch

By Karey in ActionScript, Art, Flash, Generative, Interactive

Recently obsessed by Kinetic Sketch by Modern Carpentry and Thrid Ave Design. Kinetic Sketch is an ActionScript 3.0 physics based drawing tool with the ability to create remarkable images and patterns. In each drawing session, the user adds shapes filled with either a solid color, image, or webcam video into a two dimensional physical simulation. During the simulation, the shapes trace themselves on the canvas background based on the selected draw mode (normal, speed, or collision). Users can control other various properties during the process, including gravity and negative space, creating a powerful experience.

Visit the Kinetic Sketch or check out a gallery of selected images below.

kinetic-sketch-06

(more...)

May 1, 2010 0

Flash & Multitouch

By Karey in ActionScript, Flash, Interactive, Resource, Web

Great video by StruckAxiom I found on The Flash Blog demonstrating Flash's multi-touch and gesture support capabilities.

More about the video:
Multi-Touching the Future

Read about the Flash techniques in the video:
Lessons Learned: Adventures in Multitouch

Information on the new API's that make multitouch available in Flash Player 10.1:
public final class Multitouch

PepsiCo Social Media Visualization from StruckAxiom on Vimeo.

April 9, 2010 0

Tweener Documentation & Language Reference

By Karey in ActionScript, Flash, Resource

Below is an extremely useful table to have on hand when using Tweener in ActionScript 2.0 and 3.0. Several different transition methods can be used wen using the addTween and addCaller method. They are defined by the transition parameter, and each of them define a different easing method. Click the image below to be taken to the interactive Tweener transition cheat sheet, or download the Tweener class and cheat sheet source files over at: code.google.com/p/tweener.

tweener-documentation

Tweener is an open source library for tweening in AS2.0 and AS3.0.

April 6, 2010 0

Wonderfl

By Karey in ActionScript, Flash, Interactive, Resource

Earlier this year I wrote about HYPE, a coding framework for non-developers and developers lacking a background in OOP to engage and learn ActionScript 3.0 through creative play. Recently I discovered Wonderfl, another amazing online resource and community to learn AS3. With Wonderfl, you write the AS3 code directly into the HTML form, and their server complies the code. If your code is valid, your SWF will be automatically shown beside your code. If your code contains errors they will show in the compiler.

In my opinion the remarkable thing about Wonderfl is the realtime aspect that allows to build and experiment without any Flash building tool and automatically see it in action. Also, in addition to instantly viewing your swf in your browser, code can be easily shared for others in the community to use and learn from, or 'fork.' Have a question on how to do something in Flash? If so, post your code and tag it 'question,' and someone else will fork and fix it. Overall, Wonderfl is a wonderful (ha!) learning tool that promotes experimentation and collaboration.

wonderfl.net

March 10, 2010 0

Flightpattern by Gwen Vanhee

By Karey in ActionScript, Generative, Motion

ActionScript 3.0 in action in this incredible handdrawn audio responsive video exploration by Gwen Vanhee. To build Flightpattern, Vahnee used a custom-coded brush in AS3 to draw the imagery which is essentially a particle system that responds to movement, speed, rotation, mouse gestures, audio frequencies, etc. The particle system is attached to the mouse and used as Vanhee's 'brush'. Therefore the imagery is a code reaction to mouse gestures. During 'drawing' he recorded the data and rendered it frame by frame afterwards. Changing the audio would give a slightly different result with the same general look and feel.

Also check out Gwen Vanhee's photostream.