Home » Archive

Articles in the Tutorials Category

Code Samples, Flash, Tutorials »

[21 Aug 2008 | View Comments | 4,890 views]

Here I have all of the code necessary to setup a simple AS2 flv player using progressive download. All of this script is in the first frame of the movie with the appropriate movie clips available on the stage.
First, We setup all of our controls including our Play/Pause button, Rewind, Scrubbing, and volume controls.

stop();

/*——————————————————————————–*/
//sound settings/controls
/*——————————————————————————–*/

globalsound = new Sound();
globalsound.setVolume(100);
volume_slide.volume_slider._x = volume_slide.volume_bar._width-volume_slide.volume_slider._width;

b_volume.onRelease = function() {
if(globalsound.getVolume() == 100){
b_volume.gotoAndStop(2);
globalsound.setVolume(0);
}else if(globalsound.getVolume() == 0){
b_volume.gotoAndStop(1);
globalsound.setVolume(100);
}
}

//volume scrubbing
var pTop_volume:Number = volume_slide.volume_slider._y;
var pLeft_volume:Number = 0;
var pBottom_volume:Number = volume_slide.volume_slider._y;
var pRight_volume:Number = volume_slide.volume_bar._width-volume_slide.volume_slider._width;

volume_slide.volume_slider.onPress = function() {
startDrag("volume_slide.volume_slider", false, pLeft_volume, pTop_volume, pRight_volume, pBottom_volume);
dragging = …

Code Samples, FMS, Flash, Tutorials »

[21 Aug 2008 | View Comments | 12,477 views]

Here’s a quick way to setup a Flash Media Server chat room. This process only allows for two users to video chat over Flash Media Server, and was the start of a larger project that I was involved with.
Setting Up the Flash Media Server Application
It really doesn’t matter what you use in terms of either a FMS hosting company, or your own. Most of the FMS hosting companies use the same techniques when setting up their servers for users, but that might not always be true. In general, you simply …

Code Samples, Flash, Tutorials »

[21 Aug 2008 | View Comments | 6,730 views]

Here’s a class that renders a simple wireframe sphere in Papervision3d, and allows the mouse to control the pitch and yaw. This example can be applied to any simple interactive environment.

package {
import flash.display.Sprite;
import flash.events.Event;
import org.papervision3d.cameras.*;
import org.papervision3d.objects.*;
import org.papervision3d.scenes.*;
import org.papervision3d.materials.*;

public class PaperVisionTest extends Sprite {
/** setup the container */
private var container: Sprite = new Sprite();

/** setup the scene */
private var scene: MovieScene3D = new MovieScene3D(container);

/** setup the camera */
private var camera: Camera3D = new Camera3D();

/** setup the material */
private var material:WireframeMaterial = new WireframeMaterial(0xFF0000);

/** setup the sphere */
private var sphere:Sphere = new …

Code Samples, Flash, Tutorials »

[21 Aug 2008 | View Comments | 737 views]

Here’s a simple scene that renders a Papervision3d scene within a container. There are no 3d elements added, but this is as simple as it gets.

import org.papervision3d.cameras.*;
import org.papervision3d.objects.*;
import org.papervision3d.materials.*;
import org.papervision3d.scenes.*;

var container:Sprite = new Sprite();
addChild(container);
container.x = stage.stageWidth * 0.5;
container.y = stage.stageHeight * 0.5;

var scene:Scene3D = new Scene3D(container);
var camera:Camera3D = new Camera3D();
camera.zoom = 11;

addEventListener(Event.ENTER_FRAME, loop);

function loop(e:Event):void
{
scene.renderCamera(camera);
}

If you’re interested in how this can be improved, check out the next post with a more elaborate Papervision scene.