Actionscript 3 Flash Builder赢得';不要让我重写继承的方法。I';我感到困惑
我写动作脚本已经快10年了;但是我总是使用单独的文本编辑器,比如TextMate来编写代码,并使用FlashIDE来编译它。我决定在这个周末尝试一下Flash Builder,因为这显然是前进的方向 无论如何。我在OSX上使用Flash Builder 4.6——今天早上安装,我还没有熟悉它——我构建了一个简单的“Actionscript移动应用程序”(因为我目前的工作项目是一个使用Flash IDE构建的移动air应用程序) RootLayoutSprite类源于LayoutSprite,它是我编写的布局管理API的一部分,并已在几十个大大小小的项目中使用。onLayoutUpdated和onSizeChanged方法在LayoutSprite以及size属性中定义 该定义看起来或多或少是这样的:Actionscript 3 Flash Builder赢得';不要让我重写继承的方法。I';我感到困惑,actionscript-3,flash-builder,overriding,Actionscript 3,Flash Builder,Overriding,我写动作脚本已经快10年了;但是我总是使用单独的文本编辑器,比如TextMate来编写代码,并使用FlashIDE来编译它。我决定在这个周末尝试一下Flash Builder,因为这显然是前进的方向 无论如何。我在OSX上使用Flash Builder 4.6——今天早上安装,我还没有熟悉它——我构建了一个简单的“Actionscript移动应用程序”(因为我目前的工作项目是一个使用Flash IDE构建的移动air应用程序) RootLayoutSprite类源于LayoutSprite,它是
package zakariya.layout
{
public class LayoutSprite extends Sprite {
/*
Called after this Sprite's size changes, before layout of children is executed
*/
public function onSizeChanged():void
{}
/*
Called after this Sprite's size changes, after layout of children is executed
*/
public function onLayoutUpdated():void
{}
}
}
layout代码是本地repo中的原始代码——未编译为SWC——并且都在我添加到项目源路径的文件夹结构中。FlashBuilder可以清楚地识别基类,因为它可以识别RootLayoutSprite
当我尝试构建此模型时,我得到以下结果:
1006: A super expression can be used only inside class instance methods. DoesThisEvenWork.as /DoesThisEvenWork/src line 17 Flex Problem
1010: The override attribute may be used only on class property definitions. DoesThisEvenWork.as /DoesThisEvenWork/src line 15 Flex Problem
1010: The override attribute may be used only on class property definitions. DoesThisEvenWork.as /DoesThisEvenWork/src line 21 Flex Problem
1020: Method marked override must override another method. DoesThisEvenWork.as /DoesThisEvenWork/src line 15 Flex Problem
1020: Method marked override must override another method. DoesThisEvenWork.as /DoesThisEvenWork/src line 21 Flex Problem
所以,Flash Builder不允许我覆盖这些方法。如果去掉“override”属性,flashbuilder会抱怨这些方法是在基类中定义的。脸掌
请注意,这段简单的代码在Flash IDE中运行良好。
我真的不知道发生了什么。我没有玩弄Flash Builder配置。多年来我一直避免使用Flash Builder,因为我没有编写Flex项目。。。在我空闲的时候,我写了C++,所以我对Flash Builder Eclipse工具链一无所知。
我的假设是,Flash IDE的编译器没有Flash Builder严格,因此,我一直在做错事,我不知道这是错的。
救命啊 代码也不应在Flash IDE中编译-它包含语法错误。 您在构造函数之后关闭了类声明。只要把卷曲的支架一直向下移动,一切都会好起来的
package
{
import zakariya.layout.RootLayoutSprite;
public class DoesThisEvenWork extends RootLayoutSprite
{
public function DoesThisEvenWork()
{
...
}
} // <= your class ends here
// everything below is outside of the class!
override public function onLayoutUpdated():void
{
...}
}
包
{
导入zakariya.layout.RootLayoutSprite;
public类完成此项工作扩展了RootLayoutSprite
{
公共职能完成了这项工作
{
...
}
}//您的问题是什么?为什么不能在类外使用重写
,或者为什么它可以与Flash IDE一起使用,但不能与Flash Builder一起使用?允许或使用这种样式看起来肯定是错误的。
package
{
import zakariya.layout.RootLayoutSprite;
public class DoesThisEvenWork extends RootLayoutSprite
{
public function DoesThisEvenWork()
{
...
}
} // <= your class ends here
// everything below is outside of the class!
override public function onLayoutUpdated():void
{
...}
}