Archive

Archive for the ‘Flash’ Category

Actionscript 3 – WiiFlash for use Wii Control in as3 with Papervision3D, Phidgets ServoMotor

March 12th, 2009 1 comment

Categories: Actionscript 3, Flash, Papervision3d Tags:

Tutorial actionscript 3 – Box2das3 physics in flash.

March 8th, 2009 No comments

box2das3

Box2das3 is a excelent physics engine for C++ ported to actionscript.

Web oficial: http://www.box2d.org/
Forum: http://www.box2d.org/forum/

VER EJEMPLO (similar)

Download Here:
DOWNLOAD EXAMPLE

Categories: Box2DAs3, Flash Tags:

Actionscript 3 Game – Space Invaders example, source code

March 8th, 2009 1 comment



space-invaders
This is a very precarious space invaders, which started while studying the book of design patterns “Actionscript 3.0 Design Patterns” by O’Reilly, specifically the chapter’s Factory Patern, started on this instance to mount the game (say something quite simple), was also working Mauricio Stkel, collegue. Well now I share with you what you want to see the code. The code in a project on google code, so there are for download the repository using a tool like svn version;), if someone comes to us not to mention better for the changes go in the same project. The project can continue whoever.

Here a example.
http://lab.miguelmoraleda.com/mongitime

Google Code:
http://code.google.com/p/mongitime/





Tutorial Actionscript 3 – create link button, listeners, addEventListener, events handlers

March 8th, 2009 5 comments



This post is for those who are starting with actionscript 3 and still do not understand very well the use of listeners. Explained very simply the listener are sensors that can add to objects. These sensors warn us call a function whenever a certain event occurs.

In AS2 we were able to directly tell to the instances:

myObj.onClick() {
 
}

and into this function write the behavior.

For Actionscript 3 you need to add a listener to the instance:

myObj.addEventListener(MouseEvent.CLICK, clickHandler);
 
function clickHandler(event:MouseEvent) {
  trace("myObj pressed");
}

Thus we can capture a multitude of events that long objects. Here a small list of the most common:

Event.ADDED_TO_STAGE
Event.COMPLETE
Event.ENTER_FRAME
Event.INIT
Event.CHANGE
Event.ACTIVATE
Event.ADDED
Event.CLOSE
Event.RESIZE
Event.SELECT

MouseEvent.CLICK
MouseEvent.MOUSE_DOWN
MouseEvent.MOUSE_UP
MouseEvent.MOUSE_MOVE
MouseEvent.MOUSE_OVER
MouseEvent.MOUSE_OUT
MouseEvent.ROLL_OVER
MouseEvent.ROLL_OUT

NOTE: Not all the objects dispatch all events.

This would be an example of how to open a page. Create a LINK:

graphicInstance.addEventListener(MouseEvent.CLICK, mouseClick);
 
  function mouseClick(e:MouseEvent) {
    var url:String = "http://www.miguelmoraleda.com";
    var request:URLRequest = new URLRequest(url);
    try {
        navigateToURL(request);
    }
    catch (e:Error) {
        // handle error here
    }
  }

 

Categories: Actionscript 3, Flash Tags:

Actionscript 3 MouseEvent MOUSE_OVER Vs ROLL_OVER, mouse over button

March 8th, 2009 1 comment

This is especially good for those who have the doubt which is the difference between these two events. I had so far. The thing is simple, roll identifies when the mouse enters and leaves on a resort, but if that many small childs body has within it, this event does not recognize those childs. On the other hand the event MOUSE_OVER and MOUSE_OUT difference if they do, these events accurately assess on this mouse, so it is dispatched each time the mouse switches between these childs. Clearly those who have read the forum will know that I’m not as for writing, so here I leave them an example and the code. (sorry google traslator i need to fix it)

DOWNLOAD EXAMPLE


Categories: Actionscript 3, Flash Tags:

Tutorial Papervision3D – Load Collada DAE example source

March 8th, 2009 5 comments

collada

VIEW EXAMPLE

DOWNLOAD EXAMPLE

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package
{
	import flash.events.Event;
	import org.papervision3d.materials.utils.MaterialsList;
	import org.papervision3d.materials.WireframeMaterial;
	import org.papervision3d.objects.parsers.DAE;
	import org.papervision3d.objects.DisplayObject3D;
	import org.papervision3d.view.BasicView;
	import flash.display.Sprite;
 
	public class Main extends BasicView
	{
		private var _obj:DAE;
 
		public function Main()
		{
			super(0, 0, true);
 
			createObject();
 
			_camera.zoom = 1000 / _camera.focus + 1;
			var cameraTarget:DisplayObject3D = new DisplayObject3D();
			_camera.target = cameraTarget;
 
			startRendering();
		}
 
		private function createObject():void
		{
			_obj = new DAE(false, "objeto");
			_obj.load("soccer.DAE");
			scene.addChild(_obj);
		}
 
		override protected function onRenderTick(event:Event = null):void
		{
			_obj.roll(1);
 
			super.onRenderTick(event);
		}
	}
}



Categories: Flash, Papervision3d Tags:

Flash Actionscript 3 How to rotate object 360º degrees

March 8th, 2009 No comments

This is a very simple example of how to rotate an object 360 degrees. The theory is very simple, you must have a movieclip that contains a set of images with the rotation of any element. Then you can use a Slider component to go to  movieclip frame desired.

download example



Categories: Actionscript 3, Flash Tags:

Tutorial Papervision3D – Lights, light examples source code

March 7th, 2009 No comments

papervision3d-light

VIEW EXAMPLE
DOWNLOAD EXAMPLE
In papervision3D, we can find different types of materials that work with a light: FlatShadeMaterial, GouraudMaterial, PhongMaterial, and others. Here a sample illuminated material, the FlatShadeMaterial.


Categories: Papervision3d Tags:

flash actionscript 3 AS3DMod flag or cloth effect, changing objects

March 7th, 2009 No comments

bandera-chile-320x320 as3dmod-320x320

Here another important library, AS3DMod is a library for modifying 3D objects. Its main features are:
Current version 0.2. Features include:

VER EJEMPLO
DESCARGAR EJEMPLO

1. 7 modifiers as listed above
2. a framework for creating static and animated modifier stacks
3. 4 plug-ins for the most popular 3d engines: Pv3d, Away3d, Sandy3d and Alternativa3d
4. a simple demo for each engine

The project site is in http://code.google.com/p/as3dmod/ there you can download and find more examples.



Get Adobe Flash player