动作脚本的哪一部分出现在场景中,哪一部分出现在剪辑中?

发布于 2024-07-16 07:50:13 字数 550 浏览 12 评论 0 原文

我刚刚在 Flash 中完成了学校的一项小任务,我想知道将一些动作脚本放在场景中而将其他动作脚本放在影片剪辑中的原因。

信息:我使用的是 Flash CS3 和 ActionScript 2。

我已将文件上传到此处,供任何想要查看的人使用:http://www.mediafire.com/download.php?2z2mivtmokg

现在,我完成了影片剪辑中的所有动作脚本,我想知道,为什么当我尝试时它不起作用从场景中执行? 假设我从剪辑中的动作层中取出所有代码,复制它,删除该层,转到场景,在那里制作和动作层并过去代码,为什么它不起作用?

我尝试将circle_mc(我的剪辑的名称)添加到代码中,但无济于事......

有人可以帮助我吗? 尝试使影片剪辑中不出现任何代码,因为我认为这是我最初的任务。

进一步深入:我应该如何决定哪些代码进入场景,哪些代码进入影片剪辑?

I just finished a small task for school in Flash and I'm wondering about about the reasons to put Some actionscript in the scene and other in the movie clip.

Info: I'm using Flash CS3 and ActionScript 2.

I uploaded the file here, for anyone who wants to take a look: http://www.mediafire.com/download.php?2z2mivtmokg

Now, I did all the actionscript in the movie clip and I'm wondering, why doesn't it work when I try to do it from the Scene?
Suppose I take all the code from the Actions layer in the clip, copy it, delete that layer, go to the scene, make and Actions layer there and past the code, why doesn't it work?

I've tried adding circle_mc(the name of my clip) to the code, but to no avail...

Can someone help me here? Trying to make it so that no code appears in the movie clip, cause I think that was my original assignment.

To further dig in: how should I go about deciding which code goes into the scene and which goes into the movie clip?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

野稚 2024-07-23 07:50:13

如果您位于影片剪辑内部并且可以使用“this.something”,它会引用您正在使用的影片剪辑...即:“circle_mc”,但是如果您转到根时间轴并创建一个动作层,您可以'不再使用“this”,您必须引用影片剪辑名称。 因此,如果您在根时间轴上创建了一个名为 actions 的新层,您可以粘贴此代码,它仍然可以工作(也删除 mc 内的旧代码):

var stoppedOn = 2;

circle_mc.onPress = function()
{
    circle_mc.startDrag();
}

circle_mc.onRelease = function()
{
    circle_mc.stopDrag();
}

circle_mc.onRollOver = function()
{
    circle_mc.gotoAndPlay(stoppedOn);
}

circle_mc.onRollOut = function()
{
    circle_mc.stop();
    stoppedOn = circle_mc._currentframe;
}

我个人认为,如果您将所有内容都放在其中,您的代码将保持更易于维护根时间线上的代码。 它还将为您以后使用类做好准备。 我还建议您在业余时间学习 AS3,因为这确实是一个不错的选择。

If you are inside of a movieclip and you can use "this.something" it reffers to the movieclip you are working in...ie: "circle_mc", but if you go to the root timeline and create an actions layer you can't use "this" anymore, you have to reference the movieclip name. So, if you created a new layer on the root timeline called actions, you could paste this code in and it will still work (delete your old code, inside the mc too):

var stoppedOn = 2;

circle_mc.onPress = function()
{
    circle_mc.startDrag();
}

circle_mc.onRelease = function()
{
    circle_mc.stopDrag();
}

circle_mc.onRollOver = function()
{
    circle_mc.gotoAndPlay(stoppedOn);
}

circle_mc.onRollOut = function()
{
    circle_mc.stop();
    stoppedOn = circle_mc._currentframe;
}

I personally think your code stays more maintainable if you put all of your code on the root timeline. It will also prep you for working with Classes down the line. I would also reccomend learning AS3 in your spare time as it's really the way to go.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文