如何将影片剪辑内的按钮链接到大型机(Flash CS6 AS3) [英] how do I link a button inside a movie clip into the mainframe (flash CS6 AS3)

查看:128
本文介绍了如何将影片剪辑内的按钮链接到大型机(Flash CS6 AS3)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我制作了一个带有一些按钮的影片剪辑.其背后的想法是允许使用滚动系统.唯一的问题是,我似乎无法弄清楚如何将影片剪辑内部的按钮与影片剪辑外部和主舞台上的框架链接在一起.

i have made a movie clip with some buttons inside. The idea behind this was to allow a scrolling system to be used. The only problem is i can't seem to figure out how to link a button inside a movie clip with a frame from outside of the movie clip and on the main stage.

我的代码atm是:

stop();
import flash.events.MouseEvent;

sports1.addEventListener(MouseEvent.CLICK,sport1)

function sport1(e:MouseEvent)

{
    MovieClip(root).gotoAndStop(sports)
}

我想发生的事情是,影片剪辑中的每个按钮都会将我带到主舞台上的某个特定帧,例如导航系统.我真的是新手,所以我可能还不了解所有技术术语,所以对我来说很容易:)

What i would like to happen is that each button inside the movie clip will take me to a certain frame on the main stage, like a navigation system. I am really new to flash so i may not understand all the technical terms yet, so be easy on me :)

推荐答案

因此,如果您要在舞台上创建一个主影片剪辑,并且具有充当按钮的内部影片剪辑.您希望这些内部按钮在用户与其交互时将您带到主舞台上的不同框架.

So if you are creating a Main Movie Clip on the Stage and have inner Movie Clips that are acting as buttons. You want those inner buttons to take you to different frames on the main stage when the user interacts with them.

这就是您要这样做的方式.

This is how you would do so.

您已经完成的工作将为拥有内部按钮的Main Movie剪辑提供一个实例名称sports1,任何内部按钮也将需要一个实例名称,例如某个按钮的实例名称为mcButton即可访问该按钮,您需要像这样调用它:

What you would need to do as you already done give the Main Movie clip holding the inner buttons an instance name sports1 any inner button would also need an instance name say a button has an instance name of mcButton to access that button you would need to call on it like so:

sports1.mcButton.addEventListener(MouseEvent.CLICK,sport1)
sports1.mcButton.buttonMode = true;

然后,如果您想在主舞台上单击该按钮以转到第2帧,则只需在sport1函数中执行此操作:

then if you want that button when clicked to go to frame 2 on the main stage you would simply do this in the sport1function:

function sport1(e:MouseEvent):void 
{
      gotoAndStop(2);
}

我把sports1.mcButton.buttonMode = true;扔进去了,它表明它是交互式的,即可以点击

I threw in the sports1.mcButton.buttonMode = true; that way it shows that it is interactive ie click able

这篇关于如何将影片剪辑内的按钮链接到大型机(Flash CS6 AS3)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆