主题:  我想实现用户输入哪个数,影片就播放哪一帧,可是。。。

MythColor

职务:普通成员
等级:1
金币:0.0
发贴:43
注册:2003/4/17 13:03:32
#12003/4/24 17:09:20
比如输入一个3,就播放第三帧。
在按钮上编写如下AS后
txt是舞台上的输入文本匡变量。

on (release) {
    switch(true){
        case txt=2 :
            gotoAndPlay(2);
        case txt=3 :
            gotoAndPlay(3);
        case txt=4 :
            gotoAndPlay(4);
    };
}

它提示说 “一个块中只能有一个goto....”
这是怎么回事?就算加了break也不行啊

编辑历史:[这消息被MythColor编辑过(编辑时间2003-04-25 14:32:21)]


s22

职务:版主
等级:4
金币:10.0
发贴:1634
注册:2004/12/19 13:06:46
#22003/4/25 13:28:20
_root.onPress=function(){
switch(true){
case txt=2 :
gotoAndPlay(2);
case txt=3 :
gotoAndPlay(3);
case txt=2 :
gotoAndPlay(3);
};
}



MythColor

职务:普通成员
等级:1
金币:0.0
发贴:43
注册:2003/4/17 13:03:32
#32003/4/25 15:33:38
这样还是不行啊。不管我把以上AS加在第一帧还是加在按钮上,都不行。而且系统还是提示有问题。



MythColor

职务:普通成员
等级:1
金币:0.0
发贴:43
注册:2003/4/17 13:03:32
#42003/4/25 15:43:34
s22在上个帖子中说
引用:
_root.onPress=function(){
switch(true){
case txt=2 :
gotoAndPlay(2);
case txt=3 :
gotoAndPlay(3);
case txt=2 :
gotoAndPlay(3);
};
}


看看我机器上的截图:
[img]I:\Documents and Settings\MythColor\My Documents\My Pictures\why.jpg[/img]



s22

职务:版主
等级:4
金币:10.0
发贴:1634
注册:2004/12/19 13:06:46
#52003/4/25 17:44:16
true
关键字
还有语法错误,看看帮助文件吧。

编辑历史:[这消息被s22编辑过(编辑时间2003-04-25 17:46:15)]


5D荣誉版主

职务:普通成员
等级:2
金币:1.0
发贴:515
注册:2004/1/23 23:18:37
#62003/4/25 23:34:31
btn.onRelease=function(){
gotoAndPlay(Number(txt.text));
}
试试。



janlay

职务:管理员
等级:7
金币:28.0
发贴:7244
注册:2003/11/27 18:07:11
#72003/4/25 23:49:27
在mmommo的基础上,注意要让btn在可能到达的时间轴上都可见。一个常的办法是在第一帧加入按钮,最后一帧上按F5插入帧。



MythColor

职务:普通成员
等级:1
金币:0.0
发贴:43
注册:2003/4/17 13:03:32
#82003/4/27 21:46:21
实现了。呵呵,想不到这么简单。谢谢各位!

编辑历史:[这消息被MythColor编辑过(编辑时间2003-04-27 22:06:26)]