![]() |
|
||||||||||
|
|||||||
|
|
« Предыдущая тема | Следующая тема » |
| Опции темы | Опции просмотра |
|
![]() |
![]() |
|
|
|
|||||
|
Регистрация: Jun 2005
Сообщений: 104
|
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. |
|
|||||
|
Et cetera
Регистрация: Sep 2002
Сообщений: 30,787
|
Покажите весь класс. Так вот просто добавить package и чтобы заработал, как AS3, не получится.
|
|
|||||
|
Регистрация: 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;
}
}
}
}
|
|
|||||
|
Et cetera
Регистрация: Sep 2002
Сообщений: 30,787
|
О боже, это AS1 код, который запихнули в конструктор AS3 класса. Нужно переписывать код целиком, с нуля. Писать нормальный класс и т.п.
|
|
|||||
|
Регистрация: Jun 2005
Сообщений: 104
|
ясно... вот этого я больше всего и не хотел...
|
![]() |
![]() |
Часовой пояс GMT +4, время: 02:55. |
|
|
« Предыдущая тема | Следующая тема » |
|
|