[英]Need to delay navigateToURL Flash AS3
我有一个MovieClip(称为“聊天”),当单击它时会播放,但是播放完成后需要它来导航ToURL。 这和我所得到的差不多,但是不起作用:
var chatTimer:Timer = new Timer(1000);
chats.addEventListener(MouseEvent.CLICK,startTimer);
function startTimer(event:MouseEvent):void {
chats.gotoAndPlay(2);
chats.addEventListener(TimerEvent.TIMER_COMPLETE,urlAction);
function urlAction(){
chatTimer.stop();
navigateToURL(new URLRequest("http://www.stackoverflow.com"));
}
希望能对您有所帮助! 斯蒂芬
影片剪辑到达其时间轴的最后一帧后,您似乎要调用navigationToURL。 如果使用totalFrames和currentFrame属性,则这样会容易得多,如下所示:
chats.addEventListener(MouseEvent.CLICK, begin);
/**
* Begins the playing of chats
*/
function begin(e:MouseEvent):void
{
// only runs if the movieclip is on frame 1
// (can't click it multiple times)
if(chats.currentFrame == 1)
{
chats.gotoAndPlay(2);
chats.addEventListener(Event.ENTER_FRAME, _handleChats);
}
}
function _handleChats(e:Event):void
{
var m:MovieClip = MovieClip(e.target);
if(m.currentFrame == m.totalFrames)
{
m.stop();
var req:URLRequest = new URLRequest("http://stackoverflow.com/");
navigateToURL(req, "_blank");
m.removeEventListener(Event.ENTER_FRAME, _handleChats);
}
}
希望这就是你所追求的!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.