简体   繁体   English

如何在Flash AS3中使用外部文件中的对象和符号?

[英]How to use objects and symbols in an external file in Flash AS3?

I am trying to convert all my code that is in the timeline in the Movement.fla file into code for an external file name Main.as for Flash CS6 AS3. 我正在尝试将Movement.fla文件中时间轴中的所有代码都转换为Flash CS6 AS3的外部文件名Main.as的代码。 I have no idea how to reference the objects on the stage or the symbols in the library of Movement.fla from Main.as. 我不知道如何从Main.as引用舞台上的对象或Movement.fla库中的符号。

Can someone show me how to reference objects and symbols through an external file? 有人可以告诉我如何通过外部文件引用对象和符号吗? The inclusion of some pseudo code would also be preferable. 包括一些伪代码也将是优选的。

Display objects on stage can be referenced by giving them an instance name on object's properties. 可以通过在对象的属性上为其指定实例名称来引用舞台上的显示对象。 Once an object has instance name your calls can be like this. 对象具有实例名称后,您的调用就可以像这样。

instanceName.play();
stage.addChild(instanceName); // and soo on...

Also some objects might only exist at some point in the timeline, if your previous code was at the same point in the timeline then this could be the reason why is not working as external. 同样,某些对象可能仅在时间轴上的某个时间点存在,如果您以前的代码在时间轴上的同一时间点,那么这可能就是为什么不能在外部工作的原因。 Make sure your objects always exist and not only in some frames. 确保您的对象始终存在,并且不仅存在于某些框架中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM