Actionscript 3.0:未找到类型或不是编译时常量
我有这两个错误: 场景 1,层“第 1 层”,帧 1,第 6 行 1046:未找到类型或不是编译时常量:基础知识。 场景 1,层“层 1”,第 1 帧,第 6 行 1180:调用可能未定义的方法基础知识。
我四处搜寻,但找不到解决这个问题的方法。 所以这是代码,希望大家能帮助我。
import ShowText;
import Game;
import flash.events.MouseEvent;
var basics:Basics = new Basics();
而且调用的代码是
package
{
import flash.display.MovieClip;
import flash.events.Event;
import as3isolib.display.primitive.IsoBox;
import as3isolib.display.IsoView;
import as3isolib.display.scene.IsoScene;
import as3isolib.display.scene.IsoGrid;
public class Basics extends MovieClip {
public function Basics() {
var view:IsoView = new IsoView();
view.setSize((stage.stageWidth), stage.stageHeight);
view.clipContent = true;
addChild(view);
var gridHolder:IsoScene = new IsoScene();
view.addScene(gridHolder);
scene = new IsoScene();
view.addScene(scene);
var grid:IsoGrid = new IsoGrid();
grid.cellSize = 40;
grid.setGridSize(5, 5, 0);
gridHolder.addChild(grid);
var box:IsoBox = new IsoBox();
box.setSize(40, 40, 40);
box.moveTo(80, 80, 0);
scene.addChild(box);
gridHolder.render();
scene.render();
}
}
}
我看不出问题出在哪里。
I've got these two errors:
Scene 1, Layer 'Layer 1', Frame 1, Line 6 1046: Type was not found or was not a compile-time constant: Basics.
Scene 1, Layer 'Layer 1', Frame 1, Line 6 1180: Call to a possibly undefined method Basics.
I've searched around but I can't find a solution for this problem.
So here's the code, I hope you guys can help me.
import ShowText;
import Game;
import flash.events.MouseEvent;
var basics:Basics = new Basics();
And the called code is
package
{
import flash.display.MovieClip;
import flash.events.Event;
import as3isolib.display.primitive.IsoBox;
import as3isolib.display.IsoView;
import as3isolib.display.scene.IsoScene;
import as3isolib.display.scene.IsoGrid;
public class Basics extends MovieClip {
public function Basics() {
var view:IsoView = new IsoView();
view.setSize((stage.stageWidth), stage.stageHeight);
view.clipContent = true;
addChild(view);
var gridHolder:IsoScene = new IsoScene();
view.addScene(gridHolder);
scene = new IsoScene();
view.addScene(scene);
var grid:IsoGrid = new IsoGrid();
grid.cellSize = 40;
grid.setGridSize(5, 5, 0);
gridHolder.addChild(grid);
var box:IsoBox = new IsoBox();
box.setSize(40, 40, 40);
box.moveTo(80, 80, 0);
scene.addChild(box);
gridHolder.render();
scene.render();
}
}
}
I do not see where the problem is.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
编辑:刚刚意识到您的第一个片段似乎是您在时间轴上输入的代码!相反,使用类似于我发布的内容并将该类设置为 文档类< /a> 你的项目。
您尚未导入“Basics”类,该代码片段看起来也不像有效的 AS3 类定义:
类似于以下内容的工作是否有效:
EDIT: Just realised that your first snippet appears to be code you have entered on the timeline! Instead, use something similar to what I posted and set that class to be the Document Class of your project.
You haven't imported the "Basics" class nor does that snippet look like a valid AS3 class definition:
Would something similar to the following work: