ITeye博客

flash 转盘效果

fly-sky · 2013-12-05 23:51 · flash · Web前端 · Markdown

flash 转盘效果

部分源代码:


package flash
{
	import flash.display.*;
         import flash.events.*;
         import flash.text.*;
         import flash.utils.Timer;
	import flash.net.*; 

    dynamic public class MainTimeline extends MovieClip
    {
        public var text001:TextField;
        public var text010:TextField;
        public var text002:TextField;
        public var text011:TextField;
        public var text020:TextField;
        public var txt_LineInfo:TextField;
        public var text003:TextField;
        public var text030:TextField;
        public var textna:TextField;
        public var text021:TextField;
        public var text012:TextField;
        public var text031:TextField;
        public var text013:TextField;
        public var text004:TextField;
        public var text022:TextField;
        public var text032:TextField;
        public var text005:TextField;
        public var text014:TextField;
        public var text023:TextField;
        public var text006:TextField;
        public var text033:TextField;
        public var text015:TextField;
        public var text034:TextField;
        public var text007:TextField;
        public var text016:TextField;
        public var text026:TextField;
        public var text035:TextField;
        public var text008:TextField;
        public var text017:TextField;
        public var text036:TextField;
        public var text027:TextField;
        public var text009:TextField;
        public var dp_mc:MovieClip;
        public var text037:TextField;
        public var text028:TextField;
        public var text038:TextField;
        public var text029:TextField;
  
        public var vDir:int = 10;
		var loadurl:URLLoader;
		var loc:Array = new Array();
		
	    public function MainTimeline()
        {
			readXML();
			createTimer();			
		}
		
		public function readXML(){
			var path:String = loaderInfo.parameters["path"];
			var url:URLRequest =new URLRequest(path==null?"config.xml":path);			
			loadurl = new URLLoader(url);
			loadurl.addEventListener(Event.COMPLETE,Loadxml); 
		}
		
		public function Loadxml(event:Event)
        {
		   var xml:XML=XML(loadurl.data);
		   txt_LineInfo.htmlText = xml.child(0);
		   text001.text = xml.child(1).road[0].item[0].@value;
		   text002.text = xml.child(1).road[0].item[1].@value;
		   text003.text = xml.child(1).road[0].item[2].@value;
		   text004.text = xml.child(1).road[0].item[3].@value;
		   text005.text = xml.child(1).road[0].item[4].@value;
		   text006.text = xml.child(1).road[0].item[5].@value;
		   text007.text = xml.child(1).road[0].item[6].@value;
		   textna.text = xml.child(1).road[0].item[7].@value;
		   
		   text008.text = xml.child(1).road[1].item[0].@value;
		   text009.text = xml.child(1).road[1].item[1].@value;
		   text010.text = xml.child(1).road[1].item[2].@value;
		   text011.text = xml.child(1).road[1].item[3].@value;
		   text012.text = xml.child(1).road[1].item[4].@value;
		   text013.text = xml.child(1).road[1].item[5].@value;
		   
		   text014.text = xml.child(1).road[1].item[6].@value;
		   text020.text = xml.child(1).road[1].item[7].@value;
		   text015.text = xml.child(1).road[1].item[8].@value;
		   text021.text = xml.child(1).road[1].item[9].@value;
		   text016.text = xml.child(1).road[1].item[10].@value;
		   text022.text = xml.child(1).road[1].item[11].@value;
		   text017.text = xml.child(1).road[1].item[12].@value;
		   text023.text = xml.child(1).road[1].item[13].@value;
		   
		    text026.text = xml.child(1).road[2].item[0].@value;
			text027.text = xml.child(1).road[2].item[1].@value;
			text033.text = xml.child(1).road[2].item[2].@value;
			text028.text = xml.child(1).road[2].item[3].@value;
			text034.text = xml.child(1).road[2].item[4].@value;
			text029.text = xml.child(1).road[2].item[5].@value;
			text035.text = xml.child(1).road[2].item[6].@value;
			text030.text = xml.child(1).road[2].item[7].@value;
			text036.text = xml.child(1).road[2].item[8].@value;
			text031.text = xml.child(1).road[2].item[9].@value;
			text037.text = xml.child(1).road[2].item[10].@value;
			text032.text = xml.child(1).road[2].item[11].@value;
			text038.text = xml.child(1).road[2].item[12].@value;
			
			vDir = parseFloat(xml.child(1).road[1].item[1].@speed)*10;
		}	
				
		public function createTimer():void
		{
			var myTimer:Timer = new Timer(80,0);
			myTimer.addEventListener("timer",timelistener);
			myTimer.start();
		}
		
		public function timelistener(event:TimerEvent){			
		     if(vDir >= 0 && vDir <= 15){
			    dp_mc.rotation -= vDir;
			 }else if(vDir > 15){
				 dp_mc.rotation = 15;
			 }
		}
	}
}

flash 访问webservice


 var _loc_3:* =<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
	  <soap12:Body>
	    <GetTest xmlns="http://tempuri.org/">
	    </GetTest>
	  </soap12:Body>
	</soap12:Envelope>;
	        _loc_3.child(0).child(0).id = "2013";
            var _loc_2:*="http://127.0.0.1/WebService.asmx";
            var _loc_4:* = new URLLoader();            
            var _loc_5:* = new URLRequest(_loc_2);
            _loc_5.method = URLRequestMethod.POST;
            _loc_5.contentType = "application/soap+xml; charset=utf-8";
            _loc_5.data = _loc_3.toXMLString();
            _loc_4.load(_loc_5); 
			_loc_4.addEventListener(Event.COMPLETE, complete);
			readXML();
			createTimer();			
		}
		public function complete(event:Event){
			var _loc_2:* = XML(event.target.data).child(0).child(0).child(0).toString();
			trace(_loc_2);
		}

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。