import fl.events.ListEvent;
var i:uint;
for(i=0;i<10;i++){
var tempMc:Object= new Object();
tempMc.label = "PIC"+i;
tempMc.source = new mc();
lists.addItem(tempMc);
}
lists.addEventListener(ListEvent.ITEM_CLICK,thumbClick);
function thumbClick(event:ListEvent):void{
trace(event.item.label);
}
import flash.utils.ByteArray;
import com.adobe.encoding.JPEGEncoder;
function downJpg(event:MouseEvent):void {
//?name=@@@@@@就是设置下载下来的图片名字,这个可以根据你自己想要的来修改。
var url:String="http://localhost/downjpg.php?name=testJpg.jpg";
var bmd:BitmapData = new BitmapData(320,240);
bmd.draw(review);
//下载截图质量设置
var jpgEncoder:JPEGEncoder=new JPEGEncoder(100);
var myByteArray:ByteArray=jpgEncoder.encode(bmd);
//发送数据到PHP服务器端,然后自动弹出,我下面会提供一个PHP文件,供你测试,反正
//根据我以前的做的很多东西来看,方法有N多。这是其中之一
var header:URLRequestHeader = new URLRequestHeader ("Content-type", "application/octet-stream");
var request:URLRequest=new URLRequest(url);
request.requestHeaders.push(header);
request.method=URLRequestMethod.POST;
request.data=myByteArray;
var loader:URLLoader = new URLLoader();
navigateToURL(request, "_blank");
}
var cameraVideo:Video = new Video();
addChild(cameraVideo);
cameraVideo.width =320;
cameraVideo.height =240;
var myCamera:Camera=Camera.getCamera();
if (myCamera==null) {
//trace("你还没安装视频头,或者视频头未连接");
} else {
cameraVideo.attachCamera(myCamera);
btn.addEventListener(MouseEvent.CLICK,beginSnap);
}
//main做为测试截图容器,只是测试用,下一步就不需要这个了。
var main:Sprite = new Sprite();
main.y=260;
addChild(main);
function beginSnap(event:MouseEvent):void {
//trace(cameraVideo.width);
var bitmapdata:BitmapData=new BitmapData(320,240);
bitmapdata.draw(cameraVideo);
var bitmap:Bitmap=new Bitmap(bitmapdata);
main.addChild(bitmap);
}
//只要加一句,然后修改beginSnap构造函数就可以
//先建立一个数组,用来放截图数据
var contents:Array = new Array();
function beginSnap(event:MouseEvent):void {
var bitmapdata:BitmapData=new BitmapData(320,240);
bitmapdata.draw(cameraVideo);
var bitmap:Bitmap=new Bitmap(bitmapdata);
addChild(bitmap);
contents.push(bitmap);
var i:uint;
for (i=0; i<contents.length; i++) {
var tempObj:Object = new Object();
tempObj.source=contents[i];
tempObj.label="image"+[i];
}
//lists就是tileList的实例名,我把里面的columnWidth设置为120;rowHeight设置为90
lists.addItemAt(tempObj,0);
}
NVelocity is a port of the excellent Apache Jakarta Velocity project. It is a very simple, easy to learn and extensible template engine.
Due to the lack of releases, support and bug fixes on the original port, the Castle Team decided to fork the project, bringing it to our code repository, fixing the bugs and improving it with more features.
First steps
The first thing you need to read about NVelocity is not even on this web site. You can find on the original Velocity web site.
FlexReport is a client-side report generation component. It allows you to easily generate, preview and print reports based in mxml/as3 templates. Demo Source ProjectHome
InquiryT1 /*
查询站点@StartStops到站点@EndStops之间的一次换乘乘车路线,多个站点用'/'分开,如:
exec InquiryT1 '站点1/站点2','站点3/站点4' */ Createproc InquiryT1(@StartStopsvarchar(32),@EndStopsvarchar(32)) as begin declare@ss_tabtable(name varchar(32)) declare@es_tabtable(name varchar(32)) insert@ss_tabselect Value from dbo.SplitString(@StartStops,'/') insert@es_tabselect Value from dbo.SplitString(@EndStops,'/') if(exists(select*from@ss_tab sst,@es_tab est where sst.name=est.name)) begin raiserror ('起点集和终点集中含有相同的站点',16,1) return end declare@stopstable(name varchar(32)) insert@stopsselect name from@ss_tab insert@stopsselect name from@es_tab declare@resulttable(
StartStop varchar(32),
Route1 varchar(256),
TransStop varchar(32),
Route2 varchar(256),
EndStop varchar(32),
StopCount int
) declare@countint set@count=0 —查询"步行-乘车"路线 insert@result select
sst.name as StartStop, '从'+r1.StartStop+'步行到'+r1.EndStop as Route1,
r1.EndStop as TransStop,
r2.Route as Route2,
est.name as EndStop,
r2.StopCount as StopCount from @ss_tab sst, @es_tab est,
(select*from WalkRoute where EndStop notin (select name from@stops)) r1,
RouteT0 r2 where
sst.name=r1.StartStop and r1.EndStop=r2.StartStop and r2.EndStop=est.name orderby r2.StopCount set@count=@@rowcount —查询"乘车-步行"路线 insert@result select
sst.name as StartStop,
r1.Route as Route1,
r1.EndStop as TransStop, '从'+r2.StartStop+'步行到'+r2.EndStop as Route2,
est.name as EndStop,
r1.StopCount as StopCount from @ss_tab sst, @es_tab est,
RouteT0 r1,
(select*from WalkRoute where StartStop notin (select name from@stops)) r2 where
sst.name=r1.StartStop and r1.EndStop=r2.StartStop and r2.EndStop=est.name orderby r1.StopCount set@count=@count+@@rowcount
if(@count=0) begin —查询"乘车-乘车"路线 insert@result select
sst.name as StartStop,
r1.Route as Route1,
r1.EndStop as TransStop,
r2.Route as Route2,
est.name as EndStop,
r1.StopCount+r2.StopCount as StopCount from @ss_tab sst, @es_tab est,
(select*from RouteT0 where EndStop notin (select name from@stops)) r1,
RouteT0 r2 where
sst.name=r1.StartStop and r1.EndStop=r2.StartStop and r2.EndStop=est.name and r1.Route<>r2.Route orderby r1.StopCount+r2.StopCount end select
StartStop as 起始站点,
Route1 as 路线1,
TransStop as 中转站点,
Route2 as 路线2,
EndStop as 目的站点,
StopCount as 总站点数 from @result end
假设你是一家专门出售Mud的在线商店的页面设计人员,让我们暂且称它为“在线MUD商店”。你们的业务很旺,客户下了各种类型和数量的mud订单。他们都是通过输入用户名和密码后才登陆到你的网站,登陆后就允许他们查看订单并购买更多的mud。现在,一种非常流行的mud正在打折销售。另外有一些客户规律性的购买另外一种也在打折但是不是很流行的Bright Red Mud,由于购买的人并不多所以它被安置在页面的边缘。所有用户的信息都是被跟踪并存放于数据库中的,所以某天有一个问题可能会冒出来:为什么不使用velocity来使用户更好的浏览他们感兴趣的商品呢?
foreach 的详细用法不久就会进行深入描述。重要的是,这短小的脚本能在你的网站上出现。当一个对Bright Red Mud 很感兴趣的顾客登陆的时候,同时Bright Red Mud在热卖中,这时顾客就能显著地看到。假如一个玩Terracotta Mud很久的顾客登陆,Terracotta Mud 的售卖信息就会出现在前面中间。Velocity的适用性是很巨大的,限制的只是你的创造性。
这是没有问题的:"I bought a 4 lb. sack of potatoes at the farmer's market for only $2.50!",VTL中使用$2.5这样的货币标识是没有问题得的,VTL不会将它错认为是一个reference,因为VTL中的reference总是以一个大写或者小写的字母开始。
Velocity.properties文件中的velocimacro.permissions.allow.inline.local.scale属性也是有true和false两个可选值,默认是false。它的作用是用于确定你inline定义的Velocimacros是否仅仅在被定义的template内可见。换句话说,如果这个属性设置为true,一个inline定义的Velocimacros只能在定义它的template内使用。你可以使用此设置实现一个奇妙的VM窍门:a template can define a private implementation of the second VM that will be called by the first VM when invoked by that template. All other templates are unaffected。
假设你是一家专门出售Mud的在线商店的页面设计人员,让我们暂且称它为“在线MUD商店”。你们的业务很旺,客户下了各种类型和数量的Mud订单。他们都是通过输入用户名和密码后才登陆到你的网站,登陆后就允许他们查看订单并购买更多的Mud。现在,一种非常流行的mud正在打折销售。另外有一些客户规律性的购买另外一种也打折但不是很流行的Bright Red Mud,由于购买的人并不多所以它被安置在页面的边缘。所有用户的信息都是被跟踪并存放于数据库中的,所以某天有一个问题可能会冒出来:为什么不使用nVelocity来使用户更好的浏览他们感兴趣的商品呢?