Reputation: 213
I need to try and run a method on the exact time that a certain clip in a video is playing.
so far I can do this with:
<s:VideoDisplay id="vid" currentTimeChange="checkTime()" x="208" y="49"/>
then in my script, i have
function checkTime():void{
label.text = new String(vid.currentTime);
if(Math.round(vid.currentTime) == 12){
fademe();
}
the above does work but the exact time i need is about 11.650 secs to run the method. If I take out the Math.round(), it doesn't work.
Please help, this is probably something simple but I an new to Flex and actionscript.
Thanks
Upvotes: 1
Views: 73
Reputation: 5277
change the magnitude of current time.
function checkTime():void{
label.text = new String(vid.currentTime);
int currentTime = Math.round(vid.currentTime*100) ;
if( currentTime >= 1165 && currentTime <= 1170 ){
fademe();
}
Upvotes: 1