Articles tagged with: Flash
Flash, Tutorials »
A friend my mine just asked me how he could find out how to detect his version of flash, so I wrote a quick bit of AS2 to help him out. Here’s a quick and easy way to detect a users flash version from within your Flash project.
//trace(eval("$version"));
version = eval("$version");
//The operating system: WIN, MAC, LNX
var osType;
//The player versions. 9,0,115,0
var majorVersion; 9
var majorRevision; 0
var minorVersion; 115
var minorRevision; 0
vers.text = version;
osArray = version.split(‘ ‘);
osType = osArray[0];
versionArray = osArray[1].split(‘,’);
majorVersion = versionArray[0];
majorRevision = versionArray[1];
minorVersion = versionArray[2];
minorRevision = versionArray[3];
feedback.text = "Operating System: "+osType + "\n" …
Code Samples, Flash, SEO »
A very simple RSS feed reader that displays links off to your blog created using Actionscript 2.
stop();
//create the xml object
xmlLoad = new XML();
xmlLoad.load(_root.feed);
xmlLoad.ignoreWhite = true;
xmlLoad.onLoad = function(success){
//if successful
if(success && xmlLoad.status == 0){
//reset the text
xml_text="";
//list of items
var xmlItems:XML = xmlLoad.firstChild.firstChild;
for (var m = 0; m<xmlItems.childNodes.length; m++) {
//grab each item
if (xmlItems.childNodes[m].nodeName == "item") {
for (var n = 0; n<xmlItems.childNodes[m].childNodes.length; n++) {
if (xmlItems.childNodes[m].childNodes[n].nodeName == "link") {
//grab the link of the item
itemlink=xmlItems.childNodes[m].childNodes[n].firstChild.toString();
}
if (xmlItems.childNodes[m].childNodes[n].nodeName == "title") {
//grab the title of the item
itemtitle=xmlItems.childNodes[m].childNodes[n].firstChild.toString();
}
}
//add the current item
xml_text+= "<a href=\""+itemlink+"\">"+itemtitle+"</a><br><br>";
}
}
}
//set the text
xml_holder.text = xml_text;
}
The only library item needed …
Code Samples, Flash, FMS, Tutorials »
This FLV player has quite a few advanced options included. The video is streamed from a Flash Media server, dynamically buffered, and playable. The server side scripts allow for dynamic port detection, and you can setup the player to serve differently encoded flv files based on the users bandwidth.
First let’s start with our external classes.
stop();
/*——————————————————————————–*/
//external classes
/*——————————————————————————–*/
import NCManager;
import mx.transitions.Tween;
We’re using the NCManager.as file as provided by Adobe. This external class allows us to manage our port connection list as well as detect a users bandwidth …
Code Samples, Flash, Tutorials »
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, Flash, FMS, Tutorials »
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 what you are going to 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 …
Code Samples, Flash, Tutorials »
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 »
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.
Code Samples, Flash »
Re-usable class created by brianConnatser that will set up an external XML feed to use E4X, datagrids, and much more.
Check out some of the code





