此处需要onclick影片剪辑loop_Task.addChild(tee)
之一,以跟踪tee.task_id.text
,例如从列表中单击的那个。
输出类似
(点击数:100)
(单击列表:101)
或onClick将已经单击的项目数据传递到新的班级屏幕
这是我的代码
public function resultHandlerList_items(event:SQLEvent):void
{
// TODO Auto-generated method stub
var result:SQLResult = selectStmt1.getResult();
var numResults:int = result.data.length;
for (var i:int = 0; i < numResults; i++)
{
var row:Object = result.data[i];
var tee:listview_mc = new listview_mc
loop_Task.addChild(tee)
tee.y = 270*i
tee.task_id.text = row.Tid
tee.task_tit.text = row.Ttitles
tee.task_stime.text = row.Stime
tee.task_subject.text = row.Subject
tee.addEventListener(MouseEvent.CLICK, onClickList)
}
function onClickList(e:MouseEvent):void{
trace("List Clicked : " + e.currentTarget)
}
}
答案 0 :(得分:0)
首先感谢@Organis,他给了我修复代码的方式,并给了我有关如何与编译器交谈的信息,以及如何使编译器理解您的代码。修复
(e.currentTarget as listview_mc)
,现在是修复后的我的代码,我确实采用了公共var字符串,并将其传递给其他 Class
public function resultHandlerList_items(event:SQLEvent):void
{
// TODO Auto-generated method stub
var result:SQLResult = selectStmt1.getResult();
var numResults:int = result.data.length;
for (var i:int = 0; i < numResults; i++)
{
var row:Object = result.data[i];
var tee:listview_mc = new listview_mc
loop_Task.addChild(tee)
tee.y = 270*i
tee.task_id.text = row.Tid
tee.task_tit.text = row.Ttitles
tee.task_stime.text = row.Stime
tee.task_subject.text = row.Subject
tee.addEventListener(MouseEvent.CLICK, onClickList)
}
function onClickList(e:MouseEvent):void{
trace("List Clicked : " + (e.currentTarget as listview_mc).task_id.text)
ts_id = (e.currentTarget as listview_mc).task_id.text;
sport._sport.Remove_Home_Sc(e);
trace("done")
}
}