从类访问ActionScript3嵌套的影片剪辑

编程入门 行业动态 更新时间:2024-10-28 02:30:50
本文介绍了从类访问ActionScript3嵌套的影片剪辑的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在尝试在Flash CS3中编写一个非常简单/最小的自定义视频播放器

I'm trying to write a very simple/minimal custom video player in Flash CS3

我的库中有一个带2个MovieClips的.fla文件,播放器和播放按钮. PlayButton影片剪辑位于播放器影片剪辑的第一帧中.将Player导出到actionscript并链接到可动态创建视频对象的Player.as类.

I have a .fla file with 2 MovieClips in my library, Player and PlayButton. The PlayButton movieclip is found on the first frame inside the Player movieclip. Player is exported to actionscript and linked to a Player.as class which dynamically creates a video object.

我的文档类是MPlayer.as,它向舞台添加了一个Player实例.这样效果很好,视频将自动播放.但是,我的库项目播放器"中的播放按钮"影片剪辑没有显示...而且我也不知道如何访问它或显示它.它与视频的位置不同,所以它不应该在视频的下面.我尝试了Player.as的addChild(playbutton_instance_name),但出现错误. Player影片剪辑已导出为动作脚本,但PlayButton影片剪辑未导出,因为它位于Player内.

My document class is MPlayer.as and it adds an instance of Player to the stage. This works well, and the video will play automatically. However, the PlayButton movieclip that is inside my library item Player does not show up...and I have no idea how to access it or get it to show. it is not in the same position as the video, so it shouldn't be under it...I tried addChild(playbutton_instance_name) from Player.as but I get errors. The Player movieclip is exported for actionscript, but the PlayButton movieclip is not since it's inside Player.

我可以正确设置吗?

推荐答案

有关正确的声音.如果它在您的Player MovieClip中,则将在其中导出.您确定它在播放器片段中吗?您可以像访问Player.as类的变量一样访问它,即,如果PlayButton的实例名称为"playBtn",则可以(在构造函数中)尝试

Sounds about right. If it's in your Player MovieClip, it will be exported inside of that. Are you sure it's in the Player clip? You can access it like you would a variable of your Player.as class, i.e. if the PlayButton has an instance name of "playBtn" you could (in the constructor function) try

public function Play() { trace(this.playBtn); }

如果剪辑在类中正确,则它应该跟踪类似[PlayButton]的内容.如果需要,请在您的问题中发布代码,或者,如果您愿意,我可以查看您的文件.

And if the clip is in the class properly, it should trace something like [PlayButton]. If you want, post your code in your question or I can take a look at your files if you like.

更多推荐

从类访问ActionScript3嵌套的影片剪辑

本文发布于:2023-11-23 15:33:43,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1621965.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:嵌套   影片剪辑

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!