In case Flash no longer exists; a copy of this site is included in the Flashpoint archive's "ultimate" collection.

Dead Code Preservation :: Archived AS3 works from wonderfl.net

Sample of ParticleField with BitmapParticleMaterial

...
@author ...
Get Adobe Flash player
by mtok 26 Feb 2009
package  
{
	import flash.display.Sprite;
	import flash.events.Event;
	import flash.display.StageAlign;
	import flash.display.StageScaleMode;
	import org.papervision3d.core.view.IView;
	import org.libspark.thread.Thread;
	import org.libspark.thread.EnterFrameThreadExecutor;
	/**
	 * ...
	 * @author ...
	 */
	public class Pv3d012 extends Sprite
	{
		private var _view:CustomView;
		public function Pv3d012() 
		{
			addEventListener(Event.ADDED_TO_STAGE, addedToStageHandler);
		}
		
		private function addedToStageHandler(e:Event):void 
		{
			stage.align = StageAlign.TOP_LEFT;
			stage.scaleMode = StageScaleMode.NO_SCALE;
			stage.frameRate = 30;

			if (!Thread.isReady) {
				Thread.initialize(new EnterFrameThreadExecutor());
			}
			
			var t:Thread = new MainThread(this);
			t.start();
		}
		
	}
}

import flash.display.Bitmap;
import flash.display.Sprite;
import flash.display.BitmapData;
import flash.display.Loader;
import flash.events.Event;
import flash.net.URLRequest;
import flash.system.ApplicationDomain;
import flash.system.LoaderContext;

import org.papervision3d.view.BasicView;
import org.papervision3d.objects.special.ParticleField;
import org.papervision3d.materials.special.BitmapParticleMaterial;
import org.papervision3d.materials.special.ParticleMaterial;

import org.libspark.thread.Thread;
import org.libspark.thread.threads.display.LoaderThread;
internal class MainThread extends Thread {
	private var loader:Loader;
	private var lt:LoaderThread;
	private var _view:BasicView;
	private var container:Sprite;
	public function MainThread(container:Sprite) {
		
		super();
		
		this.container = container;
	}
	override protected function run():void 
	{
		loader = new Loader();
		var req:URLRequest = new URLRequest("http://www.matzmtok.com/wonderfl/metalball_small.png");
		var context:LoaderContext = new LoaderContext(true, new ApplicationDomain(null), null);
		lt = new LoaderThread(req, context,  loader);
		lt.start();
		lt.join();
		next(playSample);
	}
	private function playSample():void {
		var bmp:Bitmap = loader.contentLoaderInfo.content as Bitmap;
		_view = new CustomView(bmp.bitmapData);
		container.addChild(_view);
	}
}

internal class CustomView extends BasicView {
	private var bmpData:BitmapData;
	private var pf:ParticleField;
	public function CustomView(bmpData:BitmapData) {
		super(0, 0, true, true);
		
		this.bmpData = bmpData;
		
		buildScene();
		startRendering();
		addEventListener(Event.ENTER_FRAME, enterFrameHandler);
	}
	
	private function enterFrameHandler(e:Event):void 
	{
		pf.rotationX += 1;
		pf.rotationY += 1;
	}
	
	protected function buildScene():void {
		
		var mf:ParticleMaterial = new BitmapParticleMaterial(bmpData);
		pf = new ParticleField(mf, 50, 50, 1000, 1000, 1000);
		scene.addChild(pf);
		
		camera.x = 0;
		camera.y = 0;
		camera.z = -1000;
	}
}