当我尝试使用 Flexbuilder 运行以下 mxml 文件时,我收到错误消息
1046:未找到类型或不是编译时常量:AlertDataObject。
此代码来自 main.mxml 文件
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
layout="vertical"
horizontalAlign="center"
verticalAlign="middle"
xmlns:components="components.*"
xmlns:ConferenceRequestForm="components.core.ConferenceRequestForm.*"
xmlns:ConferenceHomeScreen="components.core.ConferenceHomeScreen.*"
xmlns:ConferenceLoginForm="components.core.ConferenceLoginForm.*"
xmlns:debug="components.debug.*"
xmlns:RandomUserMaker="components.debug.RandomUserMaker.*"
xmlns:RandomConferenceMaker="components.debug.RandomConferenceMaker.*"
initialize="initializeApplication();"
creationComplete="openConferenceHomeScreen();">
<mx:Script>
<![CDATA[
import flash.events.MouseEvent;
public function debugButtonHandler(event:MouseEvent):void{
userCredentials.logIn('admin', 'admin', "John", "Admin", 7, 99,0)
openReportsForm();
}
]]>
</mx:Script>
<mx:Button label="Debug Button" id="debugButton_btn" click="debugButtonHandler(event);" enabled="true" visible="false"/>
<RandomConferenceMaker:RandomConferenceMaker id="rcm" visible="false"/>
<RandomUserMaker:RandomUserMaker id="rum" visible="false"/>
<mx:Script source="../classes/ConferenceApp_action.as"/>
</mx:Application>
这是ConferenceApp_action.as文件的顶部,其中包含大部分应用程序逻辑,包括导入到定义失败AlertDataObject的类的类。
//Built-In Classes
import mx.managers.PopUpManager;
//events
import mx.events.CloseEvent;
//custom events
import classes.AlertDataObject;
这是ConferenceApp_action.as文件中创建错误的行。
private function showChoiceWindow(data:AlertDataObject):void{
.
.
.
}
这是 AlertDataObject 类。
package classes
{
public class AlertDataObject
{
/****************
Constants
****************/
static public var TITLE_ALERT:String = "Alert";
static public var TITLE_CONFIRM:String = "Please Confirm";
static public var TITLE_DEBUG:String = "Debug";
static public var TITLE_SUCCESS:String = "Success";
static public var TITLE_FAILURE:String = "Failure";
static public var TITLE_ERROR:String = "Error";
/****************
Properties
****************/
private var __title:String;
private var __text:String;
.
.
/****************
Getters / Setters
****************/
public function get title():String{
return __title;
}
.
.
.
/****************
Constructor
****************/
public function AlertDataObject($text:String, $title:String="Alert", $yesFunction:Function=null, $yesFunctionArguments:Object=null, $noFunction:Function=null, $noFunctionArguments:Object=null, $dataProvider:Object=null, $icon:Class=null){
//store basic props
__title = $title;
__text = $text;
//store confirm props
__yesFunction = $yesFunction;
__yesFunctionArguments = $yesFunctionArguments;
__noFunction = $noFunction;
__noFunctionArguments = $noFunctionArguments;
//store dataProvider object
__dataProvider = $dataProvider;
//store misc. props
__icon = $icon;
}
}
}
为什么 Flex 不能正确看到 AlertDataObject 类?