标签云

参考这篇文章 http://www.cnblogs.com/axes/p/3501424.html

package
{
	import flash.display.Sprite;
	import flash.events.Event;
	import flash.events.MouseEvent;
	
	/**
	 * ...
	 * @author amyflash.com
	 */
	public class Main extends Sprite 
	{
		
		public function Main() 
		{
			if (stage) init();
			else addEventListener(Event.ADDED_TO_STAGE, init);
		}
		
		private var all:Sprite = new Sprite();
		private function init(e:Event = null):void 
		{
			removeEventListener(Event.ADDED_TO_STAGE, init);
			// entry point
			ok();
			addChild(all);
		}
		
		private var tags:Array;
		private var RADIUS:int = 200;
		private var count:int = 20;
		private var fallLength:int = 10; //焦距
		private var centerx:int = 350;
		private var centery:int = 350;
		private var lines:Sprite = new Sprite();
		private function ok():void{
			
			tags = new Array();
			lines.graphics.lineStyle(2,0x333333);
			//lines.graphics.moveTo(centerx,centery);
            for(var i:int=0;i<count;i++){
                var a:Number , b:Number;
                var k:Number = -1+(2*(i+1)-1)/count;
                a = Math.acos(k);
                b = a*Math.sqrt(count*Math.PI);
                // var a = Math.random()*2*Math.PI;
                // var b = Math.random()*2*Math.PI;
                var x:Number = RADIUS * Math.sin(a) * Math.cos(b);
                var y:Number = RADIUS * Math.sin(a) * Math.sin(b); 
                var z:Number = RADIUS * Math.cos(a);
                var t:Ball = new Ball();
                t.x = x;
				t.y = y;
				t.z = z;
                tags.push(t);
				all.addChild(t);
               // t.move();
			   
			   //lines.graphics.lineTo(t.x,t.y);
			    //lines.graphics.moveTo(t.x,t.y);
			   var scale:Number = fallLength/(fallLength-z);
				var alpha:Number = (z+RADIUS)/(2*RADIUS);
				//this.ele.style.fontSize = 15 * scale + "px";
				//t.scaleX = 15 * scale;
				//t.scaleY = 15 * scale;
				//t.scaleZ = 15 * scale;
				t.alpha =alpha+0.5;
				
            }
        	all.x = centerx;
			all.y = centery;
			lines.x = all.x;
			lines.y = all.y;
			
			addChild(lines);
			this.addEventListener(Event.ENTER_FRAME, doMove);
		}
		
	
		
		private function doMove(e:Event):void{
			//trace(sd);
			//lines.graphics.clear();
			//lines.graphics.moveTo(centerx, centery);
			 //for(var i:int=0;i<count;i++){
			//lines.graphics.lineTo(tags[i].x, tags[i].y);
			//lines.graphics.moveTo(tags[i].x, tags[i].y);
			//
			 //}
				rotateX(this.mouseX*0.0001);
				rotateY(this.mouseY*0.0001);
			
		}
		
		
		
		private function rotateX(angleX:Number):void{
			
            var cos:Number = Math.cos(angleX);
            var sin:Number = Math.sin(angleX);
            for(var i:int=0;i<count;i++){
                var y1:Number = tags[i].y * cos - tags[i].z * sin;
                var z1:Number = tags[i].z * cos + tags[i].y * sin;
                tags[i].y = y1;
                tags[i].z = z1;
				
            }
            
        }

        private function rotateY(angleY:Number):void{
            var cos:Number = Math.cos(angleY);
            var sin:Number = Math.sin(angleY);
             for(var i:int=0;i<count;i++){
                var x1:Number = tags[i].x * cos - tags[i].z * sin;
                var z1:Number = tags[i].z * cos + tags[i].x * sin;
                tags[i].x = x1;
                tags[i].z = z1;
            }
        }
		
		
		
	}
	
}
package 
{
	import flash.display.Sprite;
	import flash.filters.BitmapFilterQuality;
	import flash.filters.BlurFilter;
	import flash.filters.GlowFilter;
	
	/**
	 * ...
	 * @author amyflash.com
	 */
	public class Ball extends Sprite 
	{
		
		public function Ball() 
		{
			super();
			var ball:Sprite = new Sprite();
			ball.graphics.beginFill(0xffffff*Math.random());
			ball.graphics.drawCircle(0,0,8+3*Math.random());
			//绘制;
			ball.filters = [new BlurFilter(10, 10)];//添加模糊滤镜
			addChild(ball);
		}
		
		
		
	}

}

百度地图api测试

package
{
	import flash.display.Sprite;
	import flash.events.Event;
	import flash.net.URLLoader;
	import flash.net.URLRequest;
	import flash.net.URLRequestMethod;
	import flash.net.URLVariables;
	import flash.events.MouseEvent;
	import fl.controls.ComboBox;
	
	/**
	 * ...
	 * @author amyflash.com
	 */
	public class Main extends Sprite 
	{
		private var ul:URLLoader = new URLLoader();
		private var ua:URLRequest = new URLRequest();
		
		private var ak:String = "baidu_ak"; //换成你自己的
		//private var sn:String = "baidu_sn";
		public function Main() 
		{
			if (stage) init();
			else addEventListener(Event.ADDED_TO_STAGE, init);
		}
		
		private function init(e:Event = null):void 
		{
			removeEventListener(Event.ADDED_TO_STAGE, init);
			// entry point
			
			sb.addEventListener(MouseEvent.CLICK,doSb);
			
		}
		
		private function doSb(e:MouseEvent):void{
			 ua.method = URLRequestMethod.POST;   //.method 也为 URLLoader的一个属性值
			var urlvariables:URLVariables = new URLVariables(); //建立URLVariables对象,
			urlvariables.ak = ak; //通过cc参数传递 txtcontent里的数据
			//	urlvariables.sn = sn;	
			//urlvariables.q = "医院";//encodeURIComponent(ti.text);
			//urlvariables.region =encodeURIComponent(cb.selectedItem.label);
			ua.data = urlvariables;//讲urlvariables的数据赋值给.data
			ua.url = "http://api.map.baidu.com/place/v2/search?q="+ti.text+"&amp;region="+cb.selectedItem.label+"&amp;output=json";
			//ua.url = "http://api.map.baidu.com/place/v2/search?output=json";
			ul.load(ua);
			ul.addEventListener(Event.COMPLETE, showData);
		}

		private function showData(e:Event):void{
			
			trace(e.currentTarget.data);
			re.text = e.currentTarget.data;
		}
	}
	
}
//利用php中转,解决跨域问题
<?php
$fd1 = $_POST['message_q'];
$fd2 = $_POST['message_r'];
$homepage = file_get_contents('http://api.map.baidu.com/place/v2/search?q='.$fd1.'&region='.$fd2.'&output=json&ak=BAfb9bb97f7b712e5426859ac957c98f');
echo $homepage;
?>

或者用jsonp解决跨域问题,参考 http://tieba.baidu.com/p/2467953456