ArthurXF从业10年的CTO,受上海非凡学院邀请,进行PHP,CSS,FREEBSD等网络技能授课培训,有意向参加的,请联系.
/*
*Create by Geordi 14th Feb 2008
*function DrawSector is drawing a sector in the flash by actionscript 3
*/
import flash.display.MovieClip;
import flash.display.Sprite;
var stag:Sprite=new Sprite();
addChild(stag);
var moviec:MovieClip=new MovieClip;
stag.addChild(moviec);
var S_angle:int=60;
/* S_angle is expressed as a number between 0 and 360 degrees. it will draw a 60
* degree sector in this example, but you could change it to what ever you want
*/
DrawSector(moviec,200,200,100,S_angle,270,0xffcc00);
function DrawSector(mc:MovieClip,x:Number=200,y:Number=200,r:Number=100,
angle:Number=27,startFrom:Number=270,color:Number=0xff0000):void
/*
* mc the movieclip: the container of the sector.
* x,y the center position of the sector
* r the radius of the sector
* angle the angle of the sector
* startFrom the start degree counting point : 270 top, 180 left, 0 right, 90 bottom ,
* it is counting from top in this example.
* color the fil lin color of the sector
*/
{

/* start to fill the sector with the variable "color" if you want a sector without filling color ,
* please remove next line below.
*/
mc.graphics.beginFill(color,50); //remove this line to unfill the sector
/* the border of the secetor with color 0xff0000 (red) , you could replace it with any color
* you want like 0x00ff00(green) or 0x0000ff (blue).
*/
mc.graphics.lineStyle(0,0xff0000);
mc.graphics.moveTo(x,y);
angle=(Math.abs(angle)>360)?360:angle;
var n:Number=Math.ceil(Math.abs(angle)/45);
var angleA:Number=angle/n;
angleA=angleA*Math.PI/180;
startFrom=startFrom*Math.PI/180;
mc.graphics.lineTo(x+r*Math.cos(startFrom),y+r*Math.sin(startFrom));
for(var i=1;i<=n;i++)
{
startFrom+=angleA;
var angleMid=startFrom-angleA/2;
var bx=x+r/Math.cos(angleA/2)*Math.cos(angleMid);
var by=y+r/Math.cos(angleA/2)*Math.sin(angleMid);
var cx=x+r*Math.cos(startFrom);
var cy=y+r*Math.sin(startFrom);
mc.graphics.curveTo(bx,by,cx,cy);
}
if(angle!=360)
mc.graphics.lineTo(x,y);

mc.graphics.endFill(); // if you want a sector without filling color , please remove this line.
}
////////////////////////////////////////runing result////////////////////////////////////////////////////////
sector with fill in color: sector without fill in color:
withFill withoutFill
Tags: , ,
  WDDX是一个打包成XML的工具,可以让我们摆脱XML的格式设计。你只要将你的数组等数据打成WDDX的XML包发送出去,接收方用WDDX解包,直接还原成原来的数据格式,有了WDDX可以让我们在数据传输上,根本就不需要考虑XML的格式和命名,打包方和接收方都能很方便的就拿到想要的数据(毕竟XML并不能直接作为一种数据使用,只能做为传输数据使用)。
  这么方便的工具,不过目前好像在国内使用的并不多,大家都还是拼了命的去设计各式各样的XML,建立各种XML格式,然后又想尽办法去拆解XML格式,最终拿到要使用的数据。在这里我使用WDDX做FLASH和PHP的通讯,Flash本身并不支持WDDX,但是PHP是默认支持的,所以我在网上找来了FLASH使用的WDDX类库,可惜这个类库提供的是由FLEX支持的,里面的数据类型FLASH不支持,我就对这个类库进行了改写,希望对大家有些帮助。
  本文由ArthurXF倾情奉献。
  使用说明,下载的WDDX包中_fromArrayFlex函数是在Flex下用的,_fromArray是我改写的在FLASH下用的,支持as3的。
  请下载支持FLASH或FLEX的WDDX类库.
WDDX for as3

引用
另外本人还在搞php实习培训,到我公司跟着项目一边学习一边实践,全程指导使用本人设计的ArthurXF建站系统快速建站。有意向的朋友,可以跟我公司的小姑娘联系。QQ:272209362。

Tags: , , ,
分页: 1/1 第一页 1 最后页 [ 显示模式: 摘要 | 列表 ]