Event only works once
hi all!
i'm trying movieclip has 2 buttons change content of flvplayer.
problem buttons work once, after event listener isn't triggered (i think) have no removeeventlistener in code events i'm totally lost why happening.
code this:
stop();
var correr:boolean = true;
globals.vars.videop = cm_player;
snowmaninst.addeventlistener(mouseevent.mouse_down, mudarvideo_sm);
bananakinginst.addeventlistener(mouseevent.mouse_down, mudarvideo_bk);
addeventlistener(mouseevent.mouse_down, pararfilme);
function pararfilme(e1:mouseevent){
trace("pararfilme "+globals.vars.videop);
globals.vars.videop.stop();
correr = false;
removeeventlistener(mouseevent.mouse_down, pararfilme);
addeventlistener(mouseevent.mouse_down, correrfilme);
}
function correrfilme(e1:mouseevent){
trace("correrfilme");
globals.vars.videop.play();
correr = true;
removeeventlistener(mouseevent.mouse_down, correrfilme);
addeventlistener(mouseevent.mouse_down, pararfilme);
}
function mudarvideo_bk(e1:mouseevent){
trace("mudar video bk");
globals.vars.videop.stop();
gotoandstop(2);
}
function mudarvideo_sm(e1:mouseevent){
trace("mudarvideo_sm");
globals.vars.videop.stop();
gotoandstop(3);
}
any appreciated.
it's not clear you're trying accomplish code there few reasons might fail.
to starty, should understand first button event dispatched, main timeline event dispatched (and main timeline listener toggles between 2 listener functions) , go different frame , code in other frame executed.
so, that's pretty screwy setup. should remove main timeline listeners , functions , it's not clear need direct main timeline frame.
More discussions in Adobe Animate CC - General
adobe
Comments
Post a Comment