后来在时间线中引用MovieClip元件 [英] Reference a MovieClip symbol later on in the timeline

查看:158
本文介绍了后来在时间线中引用MovieClip元件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在试图引用在第2帧介绍了使用它的实例名,只能用时间轴脚本库符号。

I've been trying to reference a Library symbol that is introduced in Frame 2 by using it's instance name, using timeline scripting only.

我想使颜色选择器MC符号多次重复使用。首先,我画了一个小按钮,在舞台上,并转换为MC,叫类型的 textColourPicker CPicker (用于类再present这个MC图书馆)。在这个MC我有一个名为按钮元件 pickerButton

I am trying to make a colour picker MC symbol for multiple re-use. Firstly I drew a small button on the stage and converted to MC, called textColourPicker of type CPicker (the class used to represent this MC in the Library). Inside this MC I have a button symbol called pickerButton

textColourPicker MC的第一帧,我把code:

In the first frame of textColourPicker MC, I placed the code:

stop();
pickerButton.addEventListener(MouseEvent.CLICK, doShowPicker);

function doShowPicker(e:MouseEvent):void
{
    gotoAndPlay(2);

}

textColourPicker 实例的第2帧,一个新的MC将出现实例名称 pickerBox 类型 pickerBMP 。该 pickerBox 然后补间扩展至14架在这一点上我有code:

In Frame 2 of the textColourPicker instance, a new MC appears with instance name pickerBox of type pickerBMP. The pickerBox is then scale tweened until Frame 14 at which point I have the code:

stop();
pickerBox.addEventListener(MouseEvent.MOUSE_OVER, cursorToColour);

除了我总是得到错误:

Except I always get the error:

TypeError: Error #1009: Cannot access a property or method of a null object reference.
    at CPicker/frame14()[CPicker::frame14:10]

下面 CPicker 是指 textColourPicker MC的链接名称。

Here CPicker is referring to the Linkage name of the textColourPicker MC.

所以 textColourPicker 是实例: myPicker ,链接名称: CPicker

So textColourPicker is Instance of: myPicker, linkage name: CPicker

pickerBox 的实例: pickerBMP ,链接名称: pickerBMP (驻留在 textColourPicker MC里面。

and pickerBox is instance of: pickerBMP, linkage name: pickerBMP (residing inside the textColourPicker MC.

为什么没有让我引用 pickerBox MC上的框架14的 textColourPicker

Why is not allowing me to reference the pickerBox MC on Frame 14 of the textColourPicker?

textColourPicker 时间表的这一图形可以帮助说明这一切(注意两个时间线脚本图标,首先在第1帧,最后在第14帧:

This graphic of the textColourPicker timeline may help illustrate all this (note the two timeline scripting icons, first in Frame 1 last in Frame 14:

推荐答案

我写了一篇文章为InsideRIA上这样做你想要做什么。它是在这里存档:

I wrote a post for InsideRIA about doing exactly what you are trying to do. It is archived here:

http://www.developria.com/ 2010/04 /组合最时间表与 - oo.html

在我看来,是你最好的选择是的getter / setter方法​​,因为你有一个关键帧到底哪里一个新的值会被插入到该变量的值。

It seems to me that your best bet is the getter/setter method, since you have a keyframe at the end where a new value will be inserted into the variable's value.

例如code这两种方法可以在这里找到的 http://flexdiary.blogspot.com/2010/04/sample-$c$c-for-oop-timeline-insideria.html

Example code for both methods is available here http://flexdiary.blogspot.com/2010/04/sample-code-for-oop-timeline-insideria.html

心连心;

艾米

这篇关于后来在时间线中引用MovieClip元件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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