Пишу на Flex игру. Вот часть кода с ошибкой.
Ошибка
Code
C:\Documents and Settings\User\Рабочий стол\Eltaria SWF\Login\src\LoginWindow.mxml(3): Error: Could not resolve <mx:TitleWindow> to a component implementation.
Main.mxml
Code
<?xml version="1.0" encoding="utf-8"?>
<mx:Application layout="absolute" xmlns:mx="http://www.adobe.com/2006/mxml" initialize="init()">
<mx:Script><![CDATA[
import adobe.utils.CustomActions;
import flash.net.URLVariables;
import mx.rpc.events.ResultEvent;
import mx.controls.Alert;
import flash.net.navigateToURL;
import flash.external.ExternalInterface;
import mx.managers.PopUpManager;
import spark.components.TitleWindow;
private function init():void {
var loginWindow:TitleWindow = PopUpManager.createPopUp(this, LoginWindow, true) as TitleWindow;
PopUpManager.centerPopUp(loginWindow);
}
]]></mx:Script>
</mx:Application>
LoginWindow.mxml
Code
<?xml version="1.0" encoding="utf-8"?>
<mx:TitleWindow xmlns:mx="library://ns.adobe.com/flex/mx" title="Элтария: Вход" backgroundColor="0xAAAAAA" width="300" height="220" //ЗДЕСЬ ОШИБКА
horizontalScrollPolicy="off" verticalScrollPolicy="off" enterFrame="update()" initialize="init()" close="cancel()">
<mx:Script><![CDATA[
import adobe.utils.CustomActions;
import flash.net.URLVariables;
import mx.rpc.events.ResultEvent;
import mx.controls.Alert;
import flash.net.navigateToURL;
import flash.external.ExternalInterface;
import mx.managers.PopUpManager;
private var isError:Boolean = true;
private var dataSO:SharedObject = SharedObject.getLocal("eltaria.data"), posSO:SharedObject = SharedObject.getLocal("eltaria.pos");
private function init():void {
savepos.clear();
if ((save.data.email != null)&&(save.data.saveData =="true")) {
emailTextInput.text = dataSO.data.email;
emailTextInput.setStyle("fontStyle", "");
passwordTextInput.text = dataSO.data.password;
passwordTextInput.setStyle("fontStyle", "");
saveDataCheckBox.selected = true;
if (dataSO.data.autoEntry == "true") {
autoEntryCheckBox.selected = true;
login();
}
}
if (posSO.data.loginWindowX != null) {
x = savepos.data.loginWindowX;
y = savepos.data.loginWindowY;
}
testData();
}
private update():void {
entryButton.enabled = !isError;
if (isError) {
emailTextInput.setStyle("backgroundColor", "0xff9999");
passwordTextInput.setStyle("backgroundColor", "0xff9999");
} else {
emailTextInput.setStyle("backgroundColor", "0xffffff");
passwordTextInput.setStyle("backgroundColor", "0xffffff");
}
posSO.data.loginWindowX = x;
posSO.data.loginWindowY = y;
posSO.flush();
}
private function login():void {
var data:URLVariables = new URLVariables();
data.type = "0";
data.email = emailTextInput.text;
data.password = passTextInput.text;
var req:URLRequest = new URLRequest("loginquery.php");
req.method = URLRequestMethod.POST;
req.data = data;
var loader:URLLoader = new URLLoader();
loader.addEventListener(Event.COMPLETE, completeLogin);
loader.load(req);
}
private function completeLogin(e:Event):void {
try {
daraSO.clear();
if (saveDataCheckBox.selected) {
if (autoEntryCheckBox.selected)
dataSO.data.autoEntry = "true";
dataSO.data.email = emailTextInput.text;
dataSO.data.password = passwordTextInput.text;
dataSO.data.saveData = "true";
dataSO.flush();
}
PopUpManager.removePopUp(this);
} catch (e:TypeError) {
Alert.show("Нет связи с сервером. Попробуйте позже", "Ошибка!");
}
}
private function emailTextInput_focusIn() : void {
if (emailTextInput.text == "E-mail") {
emailTextInput.text = "";
emailTextInput.setStyle("fontStyle", "");
}
}
private function emailTextInput_focusOut() : void {
if (emailTextInput.text == "") {
emailTextInput.text = "E-mail";
emailTextInput.setStyle("fontStyle", "italic");
}
}
private function password_focusIn() : void {
if (passwordTextInput.text == "Пароль") {
passwordTextInput.text = "";
passwordTextInput.setStyle("fontStyle", "");
}
}
private function password_focusOut() : void {
if (passwordTextInput.text == "") {
passwordTextInput.text = "Пароль";
passwordTextInput.setStyle("fontStyle", "italic");
}
}
private function openRemind() : void {
}
private function openRegistration() : void {
}
private function testData():void {
var data:URLVariables = new URLVariables();
data.type = 1;
data.email = emailTextInput.text;
data.password = passwordTextInput.text;
var req:URLRequest = new URLRequest("loginquery.php");
req.method = URLRequestMethod.POST;
req.data = data;
var loader:URLLoader = new URLLoader();
loader.addEventListener(Event.COMPLETE, completeTestData );
loader.load(req);
}
private function completeTestData(e:Event):void {
try {
isError = Number(e.target.data) != 1;
} catch (e:TypeError) {
Alert.show("Нет связи с сервером. Попробуйте позже", "Ошибка!");
}
}
private function close():void {
navigateToURL(new URLRequest("exit.php"), "_self");
}
]]></mx:Script>
<mx:TextInput id="emailTextInput" text="E-mail" change="testData()" fontStyle="italic" textAlign="center" x="40" y="10" width="200" height="22"
toolTip="E-mail вашего аккаунта" focusIn="emailTextInput_focusIn()" focusOut="emailTextInput_focusOut()"/>
<mx:TextInput id="passwordTextInput" text="Пароль" displayAsPassword="true" change="testData()" textAlign="center" x="40" y="40" width="200" height="22"
toolTip="Пароль вашего аккаунта" focusIn="password_focusIn()" focusOut="password_focusOut()"/>
<mx:Button id="entryButton" label="Вход" click="login()" x="40" y="75" width="98" height="22"/>
<mx:Button label="Регистрация" click="openRegistration()" x="142" y="75" width="98" height="22"/>
<mx:Button label="Забыли пароль?" click="openRemind()" x="40" y="105" width="200" height="22"/>
<mx:CheckBox id="saveDataCheckBox" label="Заомнить e-mail и пароль" x="54" y="133" width="172" height="22"/>
<mx:CheckBox id="autoEntryCheckBox" label="Автоматический вход" x="68" y="153" width="145" height="22"/>
</mx:TitleWindow>