自定义的AS3类未更新 [英] Custom AS3 Class not Updating

查看:147
本文介绍了自定义的AS3类未更新的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个类似的问题这一点,但我解决了最后一个手段并不在这里工作。

I've had a similar issue to this, but the means that I solved the last one are not working here.

我有一个由12个独立的模块。作为一个自定义类。他们在文档类中声明如下:

I have a custom class that consists of 12 separate .as modules. They're declared in the document class as follows:

import trailcrest.v1.s3.averta;
import trailcrest.v1.s3.chronos;
import trailcrest.v1.s3.eripio;
import trailcrest.v1.s3.fabrilla;
import trailcrest.v1.s3.gradua;
import trailcrest.v1.s3.lingua;
import trailcrest.v1.s3.navigare;
import trailcrest.v1.s3.pedem;
import trailcrest.v1.s3.praeferre;
import trailcrest.v1.s3.scriba;
import trailcrest.v1.s3.securos;
import trailcrest.v1.s3.sonus;

public static var Averta:averta = new averta();
public static var Chronos:chronos = new chronos();
public static var Eripio:eripio = new eripio();
public static var Fabrilla:fabrilla = new fabrilla();
public static var Gradua:gradua = new gradua();
public static var Lingua:lingua = new lingua();
public static var Navigare:navigare = new navigare();
public static var Pedem:pedem = new pedem();
public static var Praeferre:praeferre = new praeferre();
public static var Scriba:scriba = new scriba();
public static var Securos:securos = new securos();
public static var Sonus:sonus = new sonus();

这是的code的新版本。我能够成功地指所有这些类和内部公共变量和函数中的osr.as文档类。我还可以看到一个模块从另一个(即圣思可以看到斯克里巴使用osr.Scriba。

This is a new version of the code. I am able to successfully refer to all of these classes and the public variables and functions inside in the "osr.as" document class. I can also SEE one module from another (i.e. Sonus can see Scriba using "osr.Scriba."

在哪里我有麻烦的是,虽然各个模块中使用,以便能够访问所有的对方的公共函数和变量完美,之后我加入了一些新的模块和变量,并删除了一些旧的,闪光专业仍是字面上使用旧版本。内的任何模块时,code提示是显示所有的旧公共函数和变量,并没有一个新的。

Where I'm having trouble is that, while the various modules used to be able to access all of each other's public functions and variables perfectly, after I added some new modules and variables and removed some old ones, Flash Professional is still literally USING the old version. Inside of any module, the code hints are showing all of the old public functions and variables, and none of the new ones.

我猜测,这已经是与某种形式的临时文件,我不能去的。我绝对需要这样的工作在本周!

I am guessing that this has something to do with some sort of temporary file that I can't get to. I absolutely need this working this week!

我的.fla是Tester.fla,和文档类是osr.as.他们都在同一个目录。另外,在同一目录下的文件夹结构/ trailcrest / V1 / S3 /,它包含了所有的Trailcrest模块。

My .fla is "Tester.fla," and the document class is "osr.as." They're both in the same directory. Also in the same directory is the folder structure "/trailcrest/v1/s3/" which contains all of the Trailcrest modules.

帮助??

编辑:每当我尝试从另一个Trailcrest类引用一个Trailcrest类(即 osr.Sonus.foo ),我得到...

Whenever I try to reference one Trailcrest class from another Trailcrest class (i.e. osr.Sonus.foo), I get...

类型错误:错误#1009:无法访问空的属性或方法   对象引用。

TypeError: Error #1009: Cannot access a property or method of a null object reference.

我已经证实超出了怀疑的阴影所有引用。

I have confirmed beyond a shadow of a doubt all references.

推荐答案

好吧,我终于想通了。下面是关于发生了什么事的消息:

Well, I finally figured it out. Here's the skinny on what was happening:

#1:闪存显然是拉旧版本的Trailcrest模块。为了解决这个问题,我备份的所有内容,然后删除Trailcrest的所有旧实例,从我的整个计算机。然后,我只放了新的模块了。这种固定code提示的问题呈现出旧模块和变量。

#1: Flash was apparently pulling an old version of the Trailcrest modules. To remedy this, I backed up everything and then removed all old instances of Trailcrest from my entire computer. Then, I put only the new modules back. That fixed the problem with Code Hints showing the old modules and variables.

#2:我一直在经历错误#1009每当出现一个Trailcrest类试图访问另一个Trailcrest类的任何组件,即使引用是正确的。

#2: I had been experiencing Error #1009 whenever one Trailcrest class tried to access any component of another Trailcrest class, even though the references were all correct.

原因是,我是直接从文档类osr.as调用函数的各种模块,功能之外。这当然,执行该程序开始。

The cause was that I was calling functions on the various modules directly from the document class osr.as, outside of a function. This, of course, executes on the program start.

不过,所有的code中调用另一个Trailcrest类(即 osr.Sonus.foo )将无法访问富一Trailcrest类因为osr.as出于某种原因或其他没有完成初始化类之前它跑了code调用它们。发生这种情况,即使问题code远远低于code表示初始化类(见我的问题)。

However, all the code within one Trailcrest class that called another Trailcrest class (i.e. osr.Sonus.foo) would not be able to access "foo" because osr.as for some reason or another hadn't finished initializing the classes before it ran the code that called them. This occurred, even though the problem code was well below the code that initialized the classes (see my question).

要解决这个问题,我根本就包装问题code到文档类中的公共静态函数,然后从时间轴调用它。这确保了所有的类都初始化之前,他们试图引用对方。

To fix this, I simply had to wrap the problem code into a public static function in the document class, and then call it from the Timeline. That ensured that all the classes were initialized before they tried referencing each other.

不用说,一切都像一个运转良好的机器上运行了。如何怪异。

Needless to say, everything is running like a well-oiled machine now. How weird.

我欢迎任何的解释,为什么这解决了这一问题。

I'd welcome any explanation as to WHY this fixed the problem.

这篇关于自定义的AS3类未更新的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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