I have an issue where I have a list component with Icon. Basically using the code below. The time in the ListPlay Class fires, i tested it with a trace and when the if statement evaluates it removes the listener, stops the timer, but it doesn’t go back to frame1.
ALSO on mouse over of the list component sometimes it bounces up, I checked the assets but they are correct and it only happens sometimes…PLEASE HELP thanks!
function addIcon(item:Object):ListPlay{
var listPlay:ListPlay= new ListPlay(this, item.data, item.mp3URL);
return listPlay;
}
startContainer_mc.soundList.iconFunction = addIcon;
package {
import flash.events.*;
import flash.display.MovieClip;
import flash.display.Stage;
import flash.utils.Timer;
public class ListPlay extends MovieClip{
private var myStage:MovieClip;
private var id:Number = 0;
private var url:String = "";
private var myTimer:Timer;
public function ListPlay(stageRef:MovieClip, idRef:Number, urlRef:String){
this.myStage = stageRef;
this.id = idRef;
this.url = urlRef;
this.myTimer = new Timer(2000);
this.addEventListener(MouseEvent.MOUSE_OVER, this.overBtn);
this.addEventListener(MouseEvent.CLICK, this.clickBtn);
this.addEventListener(MouseEvent.MOUSE_OUT, this.outBtn);
this.addEventListener(MouseEvent.MOUSE_DOWN, this.downBtn);
}
private function overBtn(e:MouseEvent){
if(this.myStage.soundPlaying && this.myStage.currentlyPlayingTarget == this.id)
this.gotoAndStop(5);
else
this.gotoAndStop(2);
}
private function clickBtn(e:MouseEvent){
if(this.myStage.soundPlaying && this.myStage.currentlyPlayingTarget == this.id)
this.gotoAndStop(3);
else
this.gotoAndStop(6);
this.myTimer.addEventListener(TimerEvent.TIMER, this.timerListener);
this.myTimer.start();
this.myStage.playSound(this.id, this.url);
}
private function downBtn(e:MouseEvent){
if(this.myStage.soundPlaying && this.myStage.currentlyPlayingTarget == this.id)
this.gotoAndStop(6);
else
this.gotoAndStop(3);
//trace(this.myStage.soundPlaying);
//trace(this.myStage.currentlyPlayingTarget);
}
private function outBtn(e:MouseEvent){
if(this.myStage.soundPlaying && this.myStage.currentlyPlayingTarget == this.id)
this.gotoAndStop(4);
else
this.gotoAndStop(1);
}
private function timerListener(e:TimerEvent):void{
if(this.myStage.currentlyPlayingTarget != this.id){
this.gotoAndStop(1);
this.myTimer.removeEventListener(TimerEvent.TIMER, this.timerListener);
this.myTimer.stop();
}
}
}
}