The Google Maps API lets you embed Google Maps in your own web pages with JavaScript. The API provides a number of utilities for manipulating maps (just like on the http://maps.google.com web page) and adding content to the map through a variety of services, allowing you to create robust maps applications on your website.
In this post I will explain how to use the Google Maps API.
After read and accept the terms and conditions and give your domain name. You will get your key.
2.- The next step is download the library kit of google maps for actionscript and flex.
To download the kit CLICK HERE
The kit contains 2 .swc files with the library.
3.- With the key and api we are ready to start with the code. Create a new project and config the library path to read the swc file downloaded. In your Flash IDE press edit-preferences-actionscript- actionscript 3 and add the folder with your swc files.
4.- THE CODE.
var _map:Map = new Map();
_map.key = "ACA DEBEN PONER SU KEY";
_map.language = "es";
_map.setSize(new Point(stage.stageWidth, stage.stageHeight));
_map.addEventListener(MapEvent.MAP_READY, onMapReady);
_map.y = 50;
addChild(_map);
function onMapReady(event:Event):void{
_map.setCenter(new LatLng(40.736072, -73.992062), 14, MapType.NORMAL_MAP_TYPE);
}
With this simple code we have our example working.
I hope this post help you to understand how works the google maps API. Any question or suggestions are welcome
package
{import flash.display.Sprite;
import flash.events.Event;
import flash.media.Sound;
import flash.media.SoundChannel;
import flash.net.URLRequest;
/**
* This class load a sound and play it in loop.
* @author http://www.miguelmoraleda.com
*/publicclass Main extends Sprite
{privatevar soundFactory:Sound;
privatevar song:SoundChannel;
publicfunction Main(){super();
loadSound("sound.mp3");
}/**
* Load the sound
* @param url
*/privatefunctionloadSound(url:String):void{var request:URLRequest = new URLRequest(url);
soundFactory = newSound();
soundFactory.addEventListener(Event.COMPLETE, completeHandler);
soundFactory.load(request);
}/**
* When sound is loaded, play it.
* @param e
*/privatefunction completeHandler(e:Event):void{
soundFactory.removeEventListener(Event.COMPLETE, completeHandler);
playSound();
}/**
* Play the sound and add listener to sound complete.
*/privatefunction playSound():void{
song = soundFactory.play();
song.addEventListener(Event.SOUND_COMPLETE, soundCompleteHandler);
}/**
* when the sound is finish play again.
* @param e
*/privatefunction soundCompleteHandler(e:Event):void{
song.removeEventListener(Event.SOUND_COMPLETE, soundCompleteHandler);
playSound();
}}}
Unity3D is a multiplatform game development tool, designed from the start to ease creation. A fully integrated professional application, Unity just happens to contain the most powerful engine this side of a million dollars.
I was working with unity, and this is the result. A free style course for drive a hummer. You can change the camera view using the number from 1 to 3 and drive the car with the rows of the keyboard
Jiglibflash is a open source 3D physics engine. Official Web.
In this tutorial we will create a simple scene with some cubes and spheres. Those object will simulate physics.
The first thing we need is to create a basic 3d scene. JigLibFlash actually support Papervision3D, Away3D and Sandy3D. For this tutorial I will be using Papervision3d.
Lets begin
To create our scene we need a viewport, camera, render engine and scene. All this things are implemented in the BasicView class, for these reason our main class will extends from there. To get more information about it, read the next post by Andy Zupko BasicView – Making Life In Papervision a Little Easier
If you compile the code now, you won’t see anything, but internally we have all neccesary things to render 3d objects. With this base we can start with the physics. In JigLibFlash you will find the Papervision3DPhysics class, it is a plugin to handle easier the engine and also have some functions to create objects.
For our example we need to add a new instance of Papervision3DPhysics in the main class.
package
{import flash.events.Event;
import jiglib.plugin.papervision3d.Papervision3DPhysics;
import org.papervision3d.view.BasicView;
publicclass Main extends BasicView
{privatevar _physics:Papervision3DPhysics;
publicfunction Main(){super(0, 0, true);
initPhysics();
startRendering();
}privatefunction initPhysics():void{//need the scene instance (Scene3D) and the speed for the engine
_physics = new Papervision3DPhysics(scene, 7);
}
override protected function onRenderTick(event:Event = null):void{//update the engine in each frame
_physics.step();
super.onRenderTick(event);
}}}
Now we have the scene ready to add objects. Again Papervision3DPhysics is a very helpful class, because it has some functions to create basic objects like Grounds, Cubes or Spheres.
How To create objects
Create Ground
1
2
3
4
5
privatefunction createGround():void{var mat:WireframeMaterial = new WireframeMaterial(0xCCCCCC);
var ground:RigidBody = _physics.createGround(mat, 1000, 0);
}
Create Cube
1
2
3
4
5
6
privatefunction createBox():void{var materials:MaterialsList = new MaterialsList();
materials.addMaterial(new WireframeMaterial(0xFF4444), "all");
var box:RigidBody = _physics.createCube(materials, 100, 100, 100, 3, 3, 3);
}
These are the functions that you can use with Papervision3DPhysics. Don’t forget that Papervision3DPhysics is a class to get things easier and faster.
I hope this tutorial results helpful for you and motivates you to learn more about JigLib. Any suggests will be great.
O3D is an open-source web API for creating rich, interactive 3D applications in the browser. This API is shared at an early stage as part of a conversation with the broader developer community about establishing an open web standard for 3D graphics.
Use the webcam in flash is very easy. You need a Video instance and Camera instance.
1
2
3
4
5
6
7
8
9
10
//Create a video instancevideo = newVideo(640, 480);
//Get the camera reference.
camara = Camera.getCamera();
//setMode need 3 params, width, height and frame rate.//Optianally you can set a boolean value at the end for the favorArea.
camara.setMode(640, 480, 30);
//put the camera in the video instancevideo.attachCamera(camara);
addChild(video);
This game is a personal project. It is about trying to keep a soccer ball in the air by clicking on it. Have a bonus system that do more difficult the game. The game works on Facebook, and you can see your friends ranking or the world ranking.
If you dont know what is a collada object. The Collada files, are 3d models exported to xml format. With Papervision3D we can create the models into our flash. If you need more info you could read the next link