![]() |
|
||||||||||
|
|||||
|
Регистрация: Oct 2006
Адрес: spb.ru
Сообщений: 3,221
|
|
|
|||||
|
Регистрация: Apr 2007
Сообщений: 1,369
|
Ага! Тяжелые секунды процессора!
|
|
|||||
|
http://kb.adobe.com/selfservice/view...nalId=tn_15512
... Loading large amounts of data If the application loading large amounts of data (for example, 1000 records returned from a query,) consider the delivery mechanism. Most applications cannot usefully display a set of 1000 records in one view. Instead, load and display data in small chunks. This may solve a variety of problems in the application: overall performance, usability, and as a side benefit it avoids triggering the timeout alert. Note: The number 1000 in this example is an arbitrary number. The maximum number of records allowed before this alert box appears depends on the amount of data in the XML file, the connection speed, and the speed of the client machine. Examples: Macromedia DataGrid Component It's difficult to work with many records at once in the DataGrid.Pull in small chunks of data, about as much as can be efficiently displayed and used at once, and you should have improved results. 100 records at once could suit the DataGrid better than 1000, for example. Loading Large XML Files Loading excessively large XML files can cause the script timeout error.
__________________
freelancer |
|
|||||
|
Регистрация: Oct 2006
Адрес: spb.ru
Сообщений: 3,221
|
Цитата:
appendChild (XMLNode.appendChild method) |
|
|||||
|
Нет. Проблема решена, я описал выше
__________________
freelancer |
|
|||||
|
Регистрация: Oct 2006
Адрес: spb.ru
Сообщений: 3,221
|
Значит так, нашел я в хелпе xml на 4 метра, наблюдал то же самое - скрипт вылетает, то есть одним куском флеш такое не парсит. Тогда я разбил этот xml на куски строк по 50 -100 блоками CDATA, получил xml такого вида:
<?xml version="1.0" encoding="UTF-8"?> <book title="Components Language Reference" directory="ComponentRef"> <![CDATA[<book> ... тут строк 50 ... </book>]]> <![CDATA[<book> ... тут строк 100 ... </book>]]> </book> И написал такое: var myX:XML = new XML();
myX.ignoreWhite = true;
var finX:XML = new XML('<xml/>');
var intervalID:Number;
var i = 1;
myX.onLoad = function (ok){
trace (ok + " " + this.status);
clearInterval(intervalID);
var node = this.firstChild.firstChild;
onEnterFrame = function () {
parseXMLPart(node);
};
};
function parseXMLPart(node){
trace (i++);
delete onEnterFrame;
txt.text = node.toString();
var tempX = new XML(node.nodeValue);
var currNode = tempX.firstChild.firstChild;
while(currNode !=null){
finX.firstChild.appendChild(currNode);
currNode = currNode.nextSibling;
}
delete currNode;
delete tempX;
node = node.nextSibling;
if (node != null) {
onEnterFrame = function (){
parseXMLPart(node);
};
}else{
delete myX;
trace(finX);
txt.text = finX.toString();
}
}
function checkProgress(xmlObj:XML):Void {
var bytesLoaded:Number = xmlObj.getBytesLoaded();
var bytesTotal:Number = xmlObj.getBytesTotal() || 10000000;
var percentLoaded:Number = Math.floor(((bytesLoaded || .01) / bytesTotal ) * 100);
txt.text = "percent loaded: " + percentLoaded;
}
myX.load('test.xml');
intervalID = setInterval(checkProgress, 100, myX);
![]() Код конечно сыроват, расчитан на xml определенной структуры.. Встроенный debug не стоит делать с xml такого размера - флеш гарантировано вылетит. Только самописный. Последний раз редактировалось Kikasso; 12.09.2007 в 00:52. |
![]() |
![]() |
Часовой пояс GMT +4, время: 21:49. |
|
|
« Предыдущая тема | Следующая тема » |
|
|