Archive for flash

Headtracking: my version

One par of my diploma was headtracking with flash. So finally i uploaded my demo. 3d moddeling was done by alexander el-meligi.

the algorithm is open source. just drop me a line, if you’re interested You can find it on the demo page

demo:

http://experiments.alexmil.de/facedetection

duplicate movieclip in as3

well this snippet won’t work for every case, but you can do it like this:

import flash.display.Sprite;
 
public class ExClip extends Sprite
{
	private var _param : String;
 
	public function ExClip(param : String)
	{
		_param = param;
	}
 
	public function clone() : ExClip
	{
		var ret : ExClip = new ExClip(_param);
 
		return ret;
	}
 
}
 
// call
var tmp1 : ExClip = new ExClip("param1");
var tmp2 : ExClip = tmp1.clone();

Works fine for me.
So long

Flash flv metadata error #1069

Working with flvs I got that error

“Error #1069 onMetaData for flash.net.NetStream not found”

Here’s the fix.

var nc : NetConnection = new NetConnection();
nc.connect(null);
var ns : NetStream = new NetStream(nc);
var vid : Video = new Video();
 
var listener : Object = new Object();
 
// this is optional
//
listener.onMetaData = function(infoObject : Object):void
{
	trace("onMetaData");
	var key : String;
	for (key in infoObject)
	{
		trace(key + ": " + infoObject[key]);
	}
}
 
// this is optional
//
listener.onCuePoint = function(infoObject : Object):void
{
	trace("onCuePoint");
	var key : String;
	for (key in infoObject)
	{
		trace(key + ": " + infoObject[key]);
	}
}
 
// this is "the magic"
//
ns.client = listener;
ns.play("videos/vid2.flv");
vid.attachNetStream(ns);
addChild(vid);

So long

Bitmapsmoothing – glätten via AS3

When you work with embed smoothing (glätten) images works with this snippet:

[Embed(source="pathto/image.png")]
private var _imgName : Class;
 
...
 
var tmpSpr : Sprite = new Sprite();
var tmpBmp : Bitmap = new _imgName as Bitmap;
 
tmpBmp.smoothing = true;
 
tmpSpr.addChild(tmpBmp);

Flashtip : Zoom in a clip to a specific point

Imagine you have to zoom in a mc on a specific point.
This math snippet works fine for me (I used TweenLite in my Code):

var tmpEndX : Number = ((spr.width)-(width*scaleFact))/2;
var tmpEndY : Number = ((spr.height)-(spr.height*scaleFact))/2;
 
var tmpXShift : Number = (mouseX-(width/2))*scaleFact;
var tmpYShift : Number = (mouseY-(spr.height/2))*scaleFact;
 
TweenMax.to(this, 0.5,{scaleX : scaleFact});
TweenMax.to(this, 0.5,{scaleY : scaleFact});
TweenMax.to(this, 0.5,{x : tmpEndX - tmpXShift});
TweenMax.to(this, 0.5,{y : tmpEndY - tmpYShift});

Demo and full Class here

Nice Camera Moving

Spring physic rules. I wanted to code the exact same thing, but I’ts already out there. A chasing cam.

http://agit8.turbulent.ca/experiments/springcam/

AS3 security error local file system + ant

use this compile property to load local files in your swf.

-use-network=false

Note: If you work on a local webserver you won’t have that problem

vertex detection in quad

Problem:

You have a quad outline as point data, and want to detect the four vertices

I googled that problem a lot but couldn’t find any solution that fitted my needs. Moreover I didn’t want to copy paste something I do not really understand, so I solved it my way

Read more »

« Older Entries

Newer Entries »