Rotation in Away3D Flash engine
In this blog entry we are going to learn about How the Rotation and camera3d and viewer3d in away3d flash engine.
Red line = x-axis
Blue line = y-axis
Green Line = z-axis
How Rotation works ..?
Rotation in away3d based on the three axis . Those are x.y and z. the component is rotated take any one of this axis as a center then rotated. In my last post the sphere is rotated along with x axis. In that example the axis is like that (see below )
sphere.rotationX = sphere.x + 1;
The sphere takes x axis as a center and rotate like above…
In this example we add two or more components in the ObjectContainer3D then rotate this objects. In this example we are going to learn about how camera3D and Viewer3D works.
Camera3d = real camera
view3d = lens the viewr of the camara
renderer = recording in real cam
scen3d = what we seen
This diagram explained in Papervision3d Essential book.. In this diagram your clearly understood about camera3d.
If we assume Camera 3d is like a real camera . we assume it is with in our application in invisible mode.
The viewerport (view3d) is an lens or what you are view using the camera.
The render engine is recording engine in the real camera. In the real camera If we start the record then only we can see the changes otherwise not. Like same as in camera3d we called
viewer.render()
method each time if anything changed in the components. In the real camara If any person is not inside the seen they are not come in the flim. Same as in the scene3d if we not add add any components in the scene 3d objects it is not visible.
How Viewer3D Works ..?
Download the source code click here (compatible for Flashdevelop IDE)
3D Animathion
Adobe support for native 3D only in cs4. There are lot of opensource flash 3d engines are there. I tried papervision3d and away3d. Both are quite well. There are lot more tutorials for both online for away3d tutorials click here , for papervision3d download this book . I got the source code of away3d from the google code http://code.google.com/p/away3d/ and for papervison3d svn http://code.google.com/p/papervision3d/. I generate swc using the command. The red5 says about away3d.
D:\sdk\Away3D>compc -include-sources ./src -source-path ./src -target-player 10 -output Away3d.swc
Initially i got this error when compile away3d “Error: Type was not found or was not a compile-time constant: Vector. in away3d”
Then i added the -target-player 10 in command line is fix that error. I think away3d is better than papervision3d.Here is my first animation here
Iam using away3d here…
If not shown http://sites.google.com/site/arulraj1985/list-of-files/away3d.swf
package
{
import away3d.cameras.Camera3D;
import away3d.cameras.HoverCamera3D;
import away3d.cameras.TargetCamera3D;
import away3d.containers.ObjectContainer3D;
import away3d.containers.Scene3D;
import away3d.containers.View3D;
import away3d.core.math.Number3D;
import away3d.materials.BitmapMaterial;
import away3d.materials.WireColorMaterial;
import away3d.primitives.Cube;
import away3d.core.render.Renderer;
import away3d.primitives.Sphere;
import away3d.primitives.WireSphere;
import away3d.core.utils.Cast;
import away3d.core.utils.CastError;
import flash.display.Bitmap;
import flash.display.Sprite;
import flash.events.Event;
import flash.events.MouseEvent;
import flash.geom.Point;
/**
* ...
* @author Arul
*/
public class FirstApplication extends Sprite
{
public var viewer:View3D;
public var scene:Scene3D;
public var camera:Camera3D;
public var cube:Cube;
public var sphere:Sphere;
public var wiresphere:WireSphere;
public var group:ObjectContainer3D;
public var material:WireColorMaterial;
public var bitmapMaterial:BitmapMaterial;
[Embed(source = "assets/favicon.jpg")] private var favicon:Class;
public var image:Bitmap = new favicon();
[SWF(backgroundColor="#EEE8DA")]
public function FirstApplication()
{
init3D();
}
public function init3D():void {
stage.frameRate = 30;
camera = new Camera3D({y:400,z:-1000});
viewer = new View3D({camera:camera,x:250,y:100,z:100});
scene = new Scene3D();
cube = new Cube();
sphere = new Sphere();
wiresphere = new WireSphere();
group = new ObjectContainer3D();
material = new WireColorMaterial();
bitmapMaterial = new BitmapMaterial(Cast.bitmap(image));
material.color = 0xA6111D;
sphere.x = 100;
sphere.y = 50;
sphere.z = 100;
sphere.radius = 75;
sphere.bothsides = true;
sphere.material = material;
group.addChild(sphere);
wiresphere.x = 270;
wiresphere.y = 150;
wiresphere.z = 150;
wiresphere.radius = 75;
wiresphere.bothsides = true;
wiresphere.material = material;
group.addChild(wiresphere);
cube.x = 250;
cube.y = 250;
cube.z = 400;
cube.material = bitmapMaterial;
group.addChild(cube);
viewer.scene.addChild(group);
viewer.render();
addChild(viewer);
addEventListener(Event.ENTER_FRAME, groupRotation);
group.addEventListener(Event.ENTER_FRAME, sphereRotation);
//addEventListener(MouseEvent.MOUSE_DOWN, lookThere);
}
public function groupRotation(e:Event):void {
group.rotationX = group.x + 1;
group.applyRotations();
viewer.render();
}
public function sphereRotation(e:Event):void {
sphere.rotationX = sphere.x + 1;
sphere.applyRotations();
wiresphere.rotationZ = wiresphere.z + 1;
wiresphere.applyRotations();
viewer.render();
}
public function lookThere(e:MouseEvent):void {
var clickpoint:Point = new Point(e.stageX, e.stageY);
var hypothines:Number = Point.distance(new Point(0, 0), clickpoint);
var sine:Number = Math.asin(e.stageX/hypothines);
var cos:Number = Math.acos(e.stageY/hypothines);
camera.lookAt(new Number3D(e.stageX, e.stageY, hypothines));
/**
* Horizontal angle
*/
camera.pan(cos);
/**
* vertical angle
*/
camera.tilt(sine);
viewer.render();
}
}
}
How to Add JMX for Red5 Server
Here we are going to know, How to managing red5 server remotely using JMX.
what is red5 server ..?

Red5 is an Open Source Flash Server written in Java that supports:
This is developed by Reverse Engineering of Adobe Flash Media server. Red5 under the GNU Lesser General Public License. You can Modify and redistribute this software.
What is JMX …?
JMX stands for Java Management eXtension . JMX is written in java technology used to monitor and manage a java application or objects.
The configuration of jmx agent in red5.properties file. the properties are
red5.properties
# JMX jmx.rmi.port.registry=9999 jmx.rmi.port.remoteobjects= jmx.rmi.host=0.0.0.0 jmx.rmi.ssl=false
jmx.rmi.port.registry – the RMI registry port
jmx.rmi.host – the host value by default 0.0.0.0 . if the host is 127.0.0.1 you can’t access in remote. Normally this is your machine ip address.
you must open the firwall for the port 9999. then only you access from remote. For more information http://bit.ly/1ACRRY
you can visualize the jvm by using this software https://visualvm.dev.java.net/
After install this Add the remote Host and Add remote JMX connection by adding
service:jmx:rmi://192.168.2.6:9999/jndi/rmi://192.168.2.6:9999/red5
192.168.2.6 – ip address of red5
the default user name for jmx is “red5user” and password is “changeme” . you can change this bu changing the access.properties and password.properties in red5 conf folder.
Hello all,
Here how to start freeswitch when machine boots.
--------------------------------------------------------------------------------#!/bin/bash # # freeswitch This starts and stops the freeswitch # # chkconfig: 345 60 50 # chkconfig: - 60 50 # description: freeswitch.sh - startup script for freeswitch on FreeBSD # processname: /usr/local/freeswitch/bin/freeswitch # pidfile: /usr/local/freeswitch/log/freeswitch.pid PATH=/sbin:/bin:/usr/bin:/usr/sbin # Source function library. . /etc/init.d/functions # Get config. test -f /etc/sysconfig/network && . /etc/sysconfig/network # Check that we are root ... so non-root users stop here [ `id -u` = 0 ] || exit 1 # Check that networking is up. [ "${NETWORKING}" = "yes" ] || exit 0 RETVAL=0 prog="Freeswitch" start() { if [ -x /usr/local/freeswitch/bin/freeswitch ] ; then echo -n $"Starting $prog: " /usr/local/freeswitch/bin/freeswitch -nc & RETVAL=$? sleep 1 fi return $RETVAL } stop() { if [ -x /usr/local/freeswitch/bin/freeswitch ] ; then echo -n $"Stopping $prog: " /usr/local/freeswitch/bin/freeswitch -stop & RETVAL=$? sleep 1 fi return $RETVAL } restart(){ stop sleep 5 start } # See how we were called. case "$1" in start) start ;; stop) stop ;; restart) restart ;; *) echo "usage: $0 { start | stop | restart }" >&2 RETVAL=1 esac exit $RETVAL--------------------------------------------------------------------------------
save these lines as file name freeswitch and copied to /etc/init.d/ folder
then run the below comments
chkconfig – -add /etc/init.d/freeswitch
chkconfig freeswitch on
you are done. Now Freeswitch will start when your PC Boots.
Freeswitch cmds:
Start : /etc/init.d/freeswitch start
Stop : /etc/init.d/freeswitch stop
Restart : /etc/init.d/freeswitch restart