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

point car

Get Adobe Flash player
by 178ep3 02 May 2009
    Embed
package
 {
	import flash.display.*;
	import flash.events.*;
	import flash.utils.*;
	
[SWF(width=500, height=500, frameRate=30, backgroundColor=0x000000)]
	public class car extends Sprite
	{
		private var _stg:Sprite;
		
		private var _pointList:Array = [
											{px:125,py:-50,	pz:-2000},
											{px:100 , py:-400 , pz:	-2000},
											{px:430 , py:-50 , pz:	-1950},
											{px:125 , py:80 , pz:	-1810},
											{px:125 , py:170 , pz:	-1660},
											{px:125 , py:225 , pz:	-1500},
											{px:125 , py:275 , pz:	-1320},
											{px:125 , py:305 , pz:	-1140},
											{px:125 , py:325 , pz:	-1000},
											{px:125 , py:365 , pz:	-840},
											{px:125 , py:385 , pz:	-680},
											{px:125 , py:375 , pz:	-500},
											{px:125 , py:600 , pz:	-50},
											{px:300 , py:600 , pz:	-25},
											{px:300 , py:630 , pz:	245},
											{px:300 , py:600 , pz:	495},
											{px:300 , py:560 , pz:	715},
											{px:500 , py:600 , pz:	25},
											{px:650 , py:550 , pz:	90},
											{px:690 , py:450 , pz:	10},
											{px:710 , py:370 , pz:	-100},
											{px:650 , py:560 , pz:	290},
											{px:650 , py:550 , pz:	490},
											{px:650 , py:530 , pz:	690},
											{px:650 , py:480 , pz:	820},
											{px:125 , py:650 , pz:	225},
											{px:125 , py:625 , pz:	500},
											{px:125 , py:600 , pz:	750},
											{px:125 , py:425 , pz:	1150},
											{px:325 , py:425 , pz:	1125},
											{px:575 , py:425 , pz:	1050},
											{px:750 , py:375 , pz:	850},
											{px:750 , py:125 , pz:	775},
											{px:750 , py:-75 , pz:	700},
											{px:775 , py:375 , pz:	600},
											{px:775 , py:350 , pz:	400},
											{px:775 , py:350 , pz:	175},
											{px:775 , py:350 , pz:	-50},
											{px:775 , py:325 , pz:	-625},
											{px:775 , py:300 , pz:	-875},
											{px:775 , py:225, pz:-1200},
											{px:775 , py:125 , pz:	-1525},
											{px:715 , py:0, pz:-1800},
											{px:595 , py:-100 , pz:	-1900},
											{px:575 , py:-275 , pz:	-1900},
											{px:650 , py:-400 , pz:	-1850},
											{px:400 , py:-350 , pz:	-1975},
											{px:200 , py:-400 , pz:	-1900},
											{px:775 , py:-350 , pz:	-1625},
											{px:825 , py:-350 , pz:	-1450},
											{px:625 , py:-350 , pz:	-1450},
											{px:825 , py:-150 , pz:	-1500},
											{px:825 , py:25 , pz:	-1425},
											{px:825 , py:100 , pz:	-1275},
											{px:825 , py:100 , pz:	-1075},
											{px:825 , py:-25 , pz:	-950},
											{px:825 , py:-150 , pz:	-900},
											{px:825 , py:-325 , pz:	-900},
											{px:625 , py:-325 , pz:	-900},
											{px:775 , py:-325 , pz:	-650},
											{px:775 , py:-325 , pz:	-375},
											{px:775 , py:-325 , pz:	-75},
											{px:775 , py:-325 , pz:	175},
											{px:775 , py:-325 , pz:	425},
											{px:775 , py:-325 , pz:	 650},
											{px:825 , py:-325 , pz:	825},
											{px:625 , py:-325 , pz:	825},
											{px:825 , py:-175 , pz:	775},
											{px:825 , py:-25 , pz:	825},
											{px:825 , py:100 , pz:	950},
											{px:825 , py:150 , pz:	1100},
											{px:825 , py:100 , pz:	1250},
											{px:825 , py:0 , pz:1375},
											{px:825 , py:-150 , pz:	1425},
											{px:825 , py:-325 , pz:	1400},
											{px:625 , py:-325 , pz:	1400},
											{px:775 , py:-325 , pz:	1575},
											{px:775 , py:-250 , pz:	1825},
											{px:600 , py:-250 , pz:	1975},
											{px:375 , py:-250 , pz:	2075},
											{px:175 , py:-250 , pz:	2100},
											{px:175 , py:0 , pz:2100},
											{px:175 , py:200, pz:2000},
											{px:675 , py:-150 , pz:	1960},	
											{px:565 , py:75 , pz:	2045},
											{px:825 , py:-425 , pz:	1275},
											{px:625 , py:-425 , pz:	-1275},
											{px:825 , py:-500 , pz:	1100},
											{px:625 , py:-500 , pz:	1100},
											{px:825 , py:-450 , pz:	950},
											{px:625 , py:-450 , pz:	950},
											{px:825 , py:-425 , pz:	-1000},
											{px:625 , py:-425 , pz:	-1000},
											{px:825 , py:-500 , pz:	-1125},
											{px:625 , py:-500 , pz:	-1125},
											{px:825 , py:-475 , pz:	-1325},
											{px:625 , py:-475 , pz:	-1325},
											{px:700 , py:350 , pz:	-225},
											{px:700 , py:150 , pz:	-350},
											{px:700 , py:0 , pz:	-475},
											{px:700 , py:-175 , pz:	-500},
											{px:525 , py:350 , pz:	-400},
											{px:300 , py:350 , pz:	-475},
											{px:375 , py:330 , pz:	-685},
											{px:375 , py:310, pz:-835},
											{px:375 , py:290 , pz:-995},
											{px:375 , py:270 , pz:	-1135},
											{px:375 , py:210 , pz:	-1325},
											{px:375 , py:190 , pz:	-1495},
											{px:375 , py:120 , pz:	-1655},
											{px:375 , py:30 , pz:	-1805},
											{px:125 , py:400 , pz:	1500},
											{px:450 , py:325 , pz:	1500},
											{px:125 , py:420 , pz:	1310},
											{px:450 , py:345 , pz:	1310},
											{px:125 , py:350 , pz:	1710},
											{px:450 , py:275 , pz:	1710},
											{px:500 , py:275 , pz:	1900},
											{px:825 , py:200 , pz:	1700},
											{px:850 , py:175	 , pz:1425},
//////////////////////////////////////
											{px:-125,py:-50,	pz:-2000},
											{px:-100 , py:	-400 , pz:	-2000},
											{px:-430 , py:	-50 , pz:	-1950},
											{px:-125 , py:	80 , pz:	-1810},
											{px:-125 , py:	170 , pz:	-1660},
											{px:-125 , py:	225 , pz:	-1500},
											{px:-125 , py:	275 , pz:	-1320},
											{px:-125 , py:	305 , pz:	-1140},
											{px:-125 , py:	325 , pz:	-1000},
											{px:-125 , py:	365 , pz:	-840},
											{px:-125 , py:	385 , pz:	-680},
											{px:-125 , py:	375 , pz:	-500},
											{px:-125 , py:	600 , pz:	-50},
											{px:-300 , py:	600 , pz:	-25},
											{px:-300 , py:	630 , pz:	245},
											{px:-300 , py:	600 , pz:	495},
											{px:-300 , py:	560 , pz:	715},
											{px:-500 , py:	600 , pz:	25},
											{px:-650 , py:	550 , pz:	90},
											{px:-690 , py:	450 , pz:	10},
											{px:-710 , py:	370 , pz:	-100},
											{px:-650 , py:	560 , pz:	290},
											{px:-650 , py:	550 , pz:	490},
											{px:-650 , py:	530 , pz:	690},
											{px:-650 , py:	480 , pz:	820},
											{px:-125 , py:	650 , pz:	225},
											{px:-125 , py:	625 , pz:	500},
											{px:-125 , py:	600 , pz:	750},
											{px:-125 , py:	425 , pz:	1150},
											{px:-325 , py:	425 , pz:	1125},
											{px:-575 , py:	425 , pz:	1050},
											{px:-750 , py:	375 , pz:	850},
											{px:-750 , py:	125 , pz:	775},
											{px:-750 , py:	-75 , pz:	700},
											{px:-775 , py:	375 , pz:	600},
											{px:-775 , py:	350 , pz:	400},
											{px:-775 , py:	350 , pz:	175},
											{px:-775 , py:	350 , pz:	-50},
											{px:-775 , py:	325 , pz:	-625},
											{px:-775 , py:	300 , pz:	-875},
											{px:-775 , py:	225	 , pz:-1200},
											{px:-775 , py:	125 , pz:	-1525},
											{px:-715 , py:	0 , pz:	-1800},
											{px:-595 , py:	-100 , pz:	-1900},
											{px:-575 , py:	-275 , pz:	-1900},
											{px:-650 , py:	-400 , pz:	-1850},
											{px:-400 , py:	-350 , pz:	-1975},
											{px:-200 , py:	-400 , pz:	-1900},
											{px:-775 , py:	-350 , pz:	-1625},
											{px:-825 , py:	-350 , pz:	-1450},
											{px:-625 , py:	-350 , pz:	-1450},
											{px:-825 , py:	-150 , pz:	-1500},
											{px:-825 , py:	25 , pz:	-1425},
											{px:-825 , py:	100 , pz:	-1275},
											{px:-825 , py:	100 , pz:	-1075},
											{px:-825 , py:	-25 , pz:	-950},
											{px:-825 , py:	-150 , pz:	-900},
											{px:-825 , py:	-325 , pz:	-900},
											{px:-625 , py:	-325 , pz:	-900},
											{px:-775 , py:	-325 , pz:	-650},
											{px:-775 , py:	-325 , pz:	-375},
											{px:-775 , py:	-325 , pz:	-75},
											{px:-775 , py:	-325 , pz:	175},
											{px:-775 , py:	-325 , pz:	425},
											{px:-775 , py: 	-325 , pz:	 650},
											{px:-825 , py:	-325 , pz:	825},
											{px:-625 , py:	-325 , pz:	825},
											{px:-825 , py:	-175 , pz:	775},
											{px:-825 , py:	-25 , pz:	825},
											{px:-825 , py:	100 , pz:	950},
											{px:-825 , py:	150 , pz:	1100},
											{px:-825 , py:	100 , pz:	1250},
											{px:-825 , py:	0 , pz:	1375},
											{px:-825 , py:	-150 , pz:	1425},
											{px:-825 , py:	-325 , pz:	1400},
											{px:-625 , py:	-325 , pz:	1400},
											{px:-775 , py:	-325 , pz:	1575},
											{px:-775 , py:	-250 , pz:	1825},
											{px:-600 , py:	-250 , pz:	1975},
											{px:-375 , py:	-250 , pz:	2075},
											{px:-175 , py:	-250 , pz:	2100},
											{px:-175 , py:	0 , pz:	2100},
											{px:-175 , py:	200	 , pz:2000},
											{px:-675 , py:	-150 , pz:	1960},	
											{px:-565 , py:	75 , pz:	2045},
											{px:-825 , py:	-425 , pz:	1275},
											{px:-625 , py:	-425 , pz:	-1275},
											{px:-825 , py:	-500 , pz:	1100},
											{px:-625 , py:	-500 , pz:	1100},
											{px:-825 , py:	-450 , pz:	950},
											{px:-625 , py:	-450 , pz:	950},
											{px:-825 , py:	-425 , pz:	-1000},
											{px:-625 , py:	-425 , pz:	-1000},
											{px:-825 , py:	-500 , pz:	-1125},
											{px:-625 , py:	-500 , pz:	-1125},
											{px:-825 , py:	-475 , pz:	-1325},
											{px:-625 , py:	-475 , pz:	-1325},
											{px:-700 , py:	350 , pz:	-225},
											{px:-700 , py:	150 , pz:	-350},
											{px:-700 , py:	0 , pz:	-475},
											{px:-700 , py:	-175 , pz:	-500},
											{px:-525 , py:	350 , pz:	-400},
											{px:-300 , py:	350 , pz:	-475},
											{px:-375 , py:	330 , pz:	-685},
											{px:-375 , py:	310	 , pz:-835},
											{px:-375 , py:	290	 , pz:-995},
											{px:-375 , py:	270 , pz:	-1135},
											{px:-375 , py:	210 , pz:	-1325},
											{px:-375 , py:	190 , pz:	-1495},
											{px:-375 , py:	120 , pz:	-1655},
											{px:-375 , py:	30 , pz:	-1805},
											{px:-125 , py:	400 , pz:	1500},
											{px:-450 , py:	325 , pz:	1500},
											{px:-125 , py:	420 , pz:	1310},
											{px:-450 , py:	345 , pz:	1310},
											{px:-125 , py:	350 , pz:	1710},
											{px:-450 , py:	275 , pz:	1710},
											{px:-500 , py:	275 , pz:	1900},
											{px:-825 , py:	200 , pz:	1700},
											{px:-850 , py:	175	 , pz:1425}
										];
										
		
		private var _fl:Number = 300;
		private var _px:Number = 0;
		private var _py:Number = 0;
		private var _pz:Number = 0;
		
		private var _vx:Number = stage.stageWidth/2;
		private var _vy:Number = stage.stageHeight/2;
		private var _vz:Number = 400;
		
		private var _g:Shape;
		
		
		public function car()
		{
			for(var i:uint=0; i<_pointList.length; i++)
			{
				_pointList[i].px = _pointList[i].px/5-40;
				_pointList[i].py = _pointList[i].py/5;
				_pointList[i].pz = _pointList[i].pz/5;
				
				_pointList[i].xx = _pointList[i].px;
				_pointList[i].yy = _pointList[i].py;
				_pointList[i].zz = _pointList[i].pz;
			}
			
			_stg = new Sprite();
			addChild(_stg);
			_stg.x = (_vx);
			_stg.y = (_vy);

			_g = new Shape();
			_stg.addChild(_g);
			
			addEventListener(Event.ENTER_FRAME,loop);
		}
		
		private function move(pt:Object):void
		{
			var ay:Number = (mouseX-_vx)/4000;
			var ax:Number = (mouseY-_vy)/4000;
			
			var temp_y:Number = pt.py*Math.cos(ax)-pt.pz*Math.sin(ax);
			var temp_z1:Number = pt.pz*Math.cos(ax)+pt.py*Math.sin(ax);
			var temp_x:Number = pt.px*Math.cos(ay)-temp_z1*Math.sin(ay);
			var temp_z:Number = pt.px*Math.sin(ay)+temp_z1*Math.cos(ay);
			
			var _scale:Number = _fl/(_fl+pt.pz+_vz);
			
			pt.px = temp_x;
			pt.py = temp_y;
			pt.pz = temp_z;
		}
		
		private function draw(pt:Object):void
		{
			var _scale:Number = _fl/(_fl+pt.pz+_vz);
			
			
			_g.graphics.beginFill(0xffffff);
			_g.graphics.drawEllipse(pt.px*_scale,-pt.py*_scale,4*_scale,4*_scale);
			_g.graphics.endFill();
		}
		
		private function loop(e:Event):void
		{
			for(var i:uint=0; i<_pointList.length; i++)
			{
			move(_pointList[i]);
			}
			
						_g.graphics.clear();
			for(var j:uint=0; j<_pointList.length; j++)
			{
			draw(_pointList[j]);
			}
		}	
	}
}