我试图用这段代码实现的目标是,如果一个剪辑在显示后被定位,它应该播放。如果星期一的选择是有针对性的,它应该播放星期一的剪辑。但是代码不起作用。错误是这样的:
Scene 1, Layer 'Layer 1', Frame 2, Line 75 1120: Access of undefined property play_event.
Scene 1, Layer 'Layer 1', Frame 2, Line 74 1120: Access of undefined property play_event.
var week_pick:Weekday_Choice = new Weekday_Choice ();
var weekdayArray: Array = new Array ();
var monday:Mon_D_but = new Mon_D_but ();
var tuesday:Tues_D_but = new Tues_D_but ();
var wednesday:Wed_D_but = new Wed_D_but ();
var thursday:Thurs_D_but = new Thurs_D_but ();
var friday:Fri_D_but = new Fri_D_but ();
var choice_play: Array = new Array ();
choice_play.push(monday, tuesday, wednesday, thursday, friday);
addChild(week_pick);
choice_play[0].x = 73.1;
choice_play[0].y = 316.75;
choice_play[1].x = 251.9;
choice_play[1].y = 278.35;
choice_play[2].x = 399.95;
choice_play[2].y = 375.85;
choice_play[3].x = 345.2;
choice_play[3].y = 602.4;
choice_play[4].x = 80.15;
choice_play[4].y = 603.05;
week_pick.addEventListener(Event.ENTER_FRAME, moveon);
function moveon(event:Event)
{
if (week_pick.currentFrame == 103)
{
week_pick.stop();
for (var a = 0; a < choice_play.length; a++)
{
addChild(choice_play [a]);
choice_play[a].alpha = 0;
choice_play[a].stop();
}
this.addEventListener(MouseEvent.CLICK,choice_play_ev);
}
}
function choice_play_ev(play_event: MouseEvent)
{
if (play_event.target != week_pick)
{
play_event.target.alpha = 1;
play_event.target.addEventListener(Event.ENTER_FRAME, play_target,false,0,true);
}
}
function play_target(e:Event)
{
play_event.target.play();
if (play_event.target.currentFrame == 15)
{
destroyall_2();
}
}
我不完全确定我这样做是否正确。屏幕上只有 2 个列表,开始时不需要任何交互的初始影片剪辑,以及单击后需要播放的剪辑。有人可以帮我解决吗?