Форум Flasher.ru
Ближайшие курсы в Школе RealTime
Список интенсивных курсов: [см.]  
  
Специальные предложения: [см.]  
  
 
Блоги Правила Справка Пользователи Календарь Сообщения за день
 

Вернуться   Форум Flasher.ru > Flash > ActionScript 3.0

Версия для печати  Отправить по электронной почте    « Предыдущая тема | Следующая тема »  
Опции темы Опции просмотра
 
Создать новую тему Ответ
Старый 25.05.2007, 14:52
Фломастер вне форума Посмотреть профиль Отправить личное сообщение для Фломастер Найти все сообщения от Фломастер
  № 1  
Ответить с цитированием
Фломастер

Регистрация: Jun 2005
Сообщений: 104
По умолчанию 1046: Type was not found or was not a compile-time constant: left.

1046: Type was not found or was not a compile-time constant: left.

что означает это сообщение?
ошибка в строчке
var xmlDoc:XMLStructure = new XMLStructure("images.xml");

XMLStructure - это мой класс, реализующий проходы по XML-файлу. он был написан на AS2.0

я в нём добавил package{} и XML типы поменял на XMLDocument

что надо сделать, чтобы AS3 увидел мой класс?

ещё флеш выдаёт такие ошибки

1046: Type was not found or was not a compile-time constant: XMLStructure.
1180: Call to a possibly undefined method XMLStructure.

Старый 25.05.2007, 15:05
etc вне форума Посмотреть профиль Найти все сообщения от etc
  № 2  
Ответить с цитированием
etc
Et cetera
 
Аватар для etc

Регистрация: Sep 2002
Сообщений: 30,787
Покажите весь класс. Так вот просто добавить package и чтобы заработал, как AS3, не получится.

Старый 25.05.2007, 15:27
Фломастер вне форума Посмотреть профиль Отправить личное сообщение для Фломастер Найти все сообщения от Фломастер
  № 3  
Ответить с цитированием
Фломастер

Регистрация: Jun 2005
Сообщений: 104
вот мой класс

Код:
package {
	import flash.xml.XMLDocument;
	import flash.xml.XMLNode;
	import flash.xml.XMLNodeType;
	import flash.system.System;

	class XMLStructure {
		static var currentImage:Image = new Image();
		static var currentFolder:Folder = new Folder();
		static var input_xml = new XMLDocument();
		function XMLStructure(xml_document:String) {
			var nodeDepth = 0;
			XMLNode.prototype.nextNodeTab = function() {
			if (this.firstChild != null) {
			this.firstChild.attributes.tab = ++nodeDepth;
			return this.firstChild;
			}
			var n = this;
			while (n.nextSibling == null) {
			if (n.parentNode) {
			nodeDepth--;
			n = n.parentNode;
			} else {
			return null;
			}
			}
			n.nextSibling.attributes.tab = nodeDepth;
			return n.nextSibling;
			};
			XMLNode.prototype.nextNode = function() {
			if (this.firstChild != null) {
			//this.firstChild.attributes.tab = ++_root.nodeDepth;
			return this.firstChild;
			}
			var n = this;
			while (n.nextSibling == null) {
			if (n.parentNode) {
			//_root.nodeDepth--;
			n = n.parentNode;
			} else {
			return null;
			}
			}
			//n.nextSibling.attributes.tab = _root.nodeDepth;
			return n.nextSibling;
			};
			XMLNode.prototype.previousNode = function() {
			var n = this;
			if (n.previousSibling == null) {
			if (n.parentNode) {
			
			n = n.parentNode;
			return n;
			} else {
			return null;
			}
			}
			n = n.previousSibling;
			while (n.lastChild != null) {
			
			n=n.lastChild;
			}
			
			return n;
			};
			XMLNode.prototype.get_parentNode = function() {
			var n = this;
			return n.parentNode;
			};
			System.useCodePage = true;
			input_xml.ignoreWhite = true;//  было XMLDocument.prototype.ignoreWhite = true;
			input_xml.load(xml_document);
			//var intervalID:Number = setInterval(checkProgress, 1, input_xml);
			input_xml.onLoad = function(success) {
			//clearInterval(intervalID);
			//trace("intervalID: "+intervalID);
			if (success) {
			if (this.status != 0) {
			trace("xml - invalid");
			} else {
			trace("successfull");
			this.addAttributes();
			this.init();
			}
			} else {
			trace("error opening URL");
			}
			};
			input_xml.addAttributes = function() {
			var i = 0;
			var nod = this.firstChild;
			while (nod) {
			nod.attributes.ID = i++;
			nod = nod.nextNodeTab();
			}
			this.parseXML(this.firstChild);
			};
			input_xml.init = function() {
			var nod = input_xml.firstChild;
			while (nod.attributes.ID == 0) {
			nod = nod.nextNode();
			}
			if (nod == null) {
			trace("no images");
			return null;
			} else {
			currentFolder = nod.parentNode.attributes;
			while (nod.nodeName.toUpperCase() != "IMAGE") {
			nod = nod.nextSibling;
			if (nod == null) {
			trace("no images");
			return null;
			} else {
			currentFolder = nod.parentNode.attributes;
			}
			}
			currentImage = nod.attributes;
			return currentImage.name;
			}
			};
		}
		var checkProgress = function () {
		var bytesLoaded:Number = input_xml.getBytesLoaded();
		var bytesTotal:Number = input_xml.getBytesTotal();
		var percentLoaded:Number = Math.floor((bytesLoaded/bytesTotal)*100);
		if (isNaN(percentLoaded)) {
		return 0;
		} else {
		return percentLoaded;
		}
		};
		function nextImage() {
			var nod = input_xml.firstChild;
			while (nod.attributes.ID != currentImage.ID) {
				nod = nod.nextNode();
			}
			nod = nod.nextNode();
			if (nod == null) {
				trace("images ends");
				return null;
			} else {
				currentFolder = nod.parentNode.attributes;
				while (nod.nodeName.toUpperCase() != "IMAGE") {
					nod = nod.nextNode();
					if (nod == null) {
						trace("images ends");
						return null;
					} else {
						currentFolder = nod.parentNode.attributes;
					}
				}
				currentImage = nod.attributes;
				return currentImage.name;
			}
		}
		function previousImage() {
			var nod = input_xml.firstChild;
			while (nod.attributes.ID != currentImage.ID) {
				nod = nod.nextNode();
			}
			nod = nod.previousNode();
			if (nod == null) {
				trace("images ends");
				return null;
			} else {
				currentFolder = nod.parentNode.attributes;
				while (nod.nodeName.toUpperCase() != "IMAGE") {
					nod = nod.previousNode();
					if (nod == null) {
						trace("images ends");
						return null;
					} else {
						currentFolder = nod.parentNode.attributes;
					}
				}
				currentImage = nod.attributes;
				return currentImage.name;
			}
		}
		function get_currentImage() {
			return currentImage;
		}
		function set_currentImage(identificator:Number) {
			var nod = input_xml.firstChild;
			while (nod.attributes.ID != identificator) {
				nod = nod.nextNode();
			}
			if (nod == null) {
				trace("images ends");
				return null;
			} else {
				currentFolder = nod.parentNode.attributes;
				while (nod.nodeName.toUpperCase() != "IMAGE") {
					nod = nod.nextNode();
					if (nod == null) {
						trace("images ends");
						return null;
					} else {
						currentFolder = nod.parentNode.attributes;
					}
				}
				currentImage = nod.attributes;
				return currentImage.name;
			}
		}
	}
}

Старый 25.05.2007, 15:31
etc вне форума Посмотреть профиль Найти все сообщения от etc
  № 4  
Ответить с цитированием
etc
Et cetera
 
Аватар для etc

Регистрация: Sep 2002
Сообщений: 30,787
О боже, это AS1 код, который запихнули в конструктор AS3 класса. Нужно переписывать код целиком, с нуля. Писать нормальный класс и т.п.

Старый 25.05.2007, 15:47
Фломастер вне форума Посмотреть профиль Отправить личное сообщение для Фломастер Найти все сообщения от Фломастер
  № 5  
Ответить с цитированием
Фломастер

Регистрация: Jun 2005
Сообщений: 104
ясно... вот этого я больше всего и не хотел...

Создать новую тему Ответ Часовой пояс GMT +4, время: 02:55.
Быстрый переход
  « Предыдущая тема | Следующая тема »  

Ваши права в разделе
Вы не можете создавать новые темы
Вы не можете отвечать в темах
Вы не можете прикреплять вложения
Вы не можете редактировать свои сообщения

BB коды Вкл.
Смайлы Вкл.
[IMG] код Вкл.
HTML код Выкл.


 


Часовой пояс GMT +4, время: 02:55.


Copyright © 1999-2008 Flasher.ru. All rights reserved.
Работает на vBulletin®. Copyright ©2000 - 2026, Jelsoft Enterprises Ltd. Перевод: zCarot
Администрация сайта не несёт ответственности за любую предоставленную посетителями информацию. Подробнее см. Правила.