大家应该知道asfunction里只能写一个参数,这是mm订的,谁都没办法。但是我们可以利用其他方法来变通:
假如我们想在点击press文本时,调用test方法,并把paramA,paramB传给test,那么我们可以把这两个参数先用~连接成一个字符串,然后再在test()方法里拆开这个这个字符串
<a asfunction:test,paramA~paramB>press</a>
function test(p:String){
var tempArray:Array = p.split("~");
for(var i=0;i<tempArray.length;i++){
//拆分每个字符串
trace("tempArray[i]="+tempArray[i]);
}
}
假如我们想在点击press文本时,调用test方法,并把paramA,paramB传给test,那么我们可以把这两个参数先用~连接成一个字符串,然后再在test()方法里拆开这个这个字符串
<a asfunction:test,paramA~paramB>press</a>
function test(p:String){
var tempArray:Array = p.split("~");
for(var i=0;i<tempArray.length;i++){
//拆分每个字符串
trace("tempArray[i]="+tempArray[i]);
}
}
回复Comments
{commenttime}{commentauthor}
{CommentUrl}
{commentcontent}