# AS3::: How to handle Error 1088: which occours by loading a swf file

**URL:** <https://forum.kirupa.com/t/as3-how-to-handle-error-1088-which-occours-by-loading-a-swf-file/332170>\
**Category:** flash\
**Created:** [February 20, 2014, 5:03pm UTC](https://forum.kirupa.com/t/as3-how-to-handle-error-1088-which-occours-by-loading-a-swf-file/332170 "2014-02-20T17:03:33Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![tomeciu](https://avatars.discourse-cdn.com/v4/letter/t/9fc29f/32.png) [@tomeciu](https://forum.kirupa.com/u/tomeciu)\
**Post date:** [February 20, 2014, 5:03pm UTC](https://forum.kirupa.com/t/as3-how-to-handle-error-1088-which-occours-by-loading-a-swf-file/332170/1 "2014-02-20T17:03:33Z")

</div>

Hi!  
My project has such u construction:  
`home.fla` - main file where I created my Website layout and menus with submenus  
`gallery.fla` (where I have all needed Movie Clips)with three classes:  
1 - `Miniaturka` which loads `*.img` files  
2 - `Miniaturki` which loads `*.xml` file  
3 - `Doc object` which has the functions `stage.scaleMode`, `stage.align` and `Event.RESIZE`  
And when i publish the `gallery.fla` to swf everything works fine.

But when i load by clickin one of my submenus the published gallery.swf then i get this error:

```auto
TypeError: Error #1088: The markup in the document following the root element must be well-formed.
        at Miniaturki/onLoadXMLComplete()
        at flash.events::EventDispatcher/dispatchEventFunction()
        at flash.events::EventDispatcher/dispatchEvent()
        at flash.net::URLLoader/onComplete()

```

When i try to debug it i get in output also this:

```auto
Cannot display source code at this location.

```

The code where I load the xml file, looks so:

```auto
public class Miniaturki extends MovieClip {
    private var mini:Array;
    private var loader:URLLoader;
    private var xml1:XML;
    private var draging:Boolean = false;
    public var count:Number = -1;
    private var loadCompleteCount:int = 0;
    private var savedImgs:Array = [];
    
    public function Miniaturki():void
    {
        loader = new URLLoader();
        loader.load(new URLRequest("obrazki.xml"));
        loader.addEventListener(Event.COMPLETE,onLoadXMLComplete);
    }
    
    private function onLoadXMLComplete(event:Event):void
    {
        xml1 = new XML(URLLoader(event.target).data);
        trace(URLLoader(event.target).data);
        var i:Number;
        mini = new Array(xml1.obrazek.length());
        count = xml1.obrazek.length();
        for (i=0;i<count;i++)
        {
            mini* = new Miniaturka(xml1.obrazek*.attribute("id"),i,callback);
        }
        
        MovieClip(parent).nazwa.text = xml1.obrazek[0];
        MovieClip(parent).ilosc.text = "1/"+count;
        MovieClip(parent).scro.buttonMode = true;
        stage.addEventListener(MouseEvent.MOUSE_DOWN, beginDrag);
    }

```

And the xml file looks so:

```auto
   <?xml version="1.0" encoding="utf-8"?>
        <obrazki>
        <obrazek id="1"><![CDATA[Some text]]></obrazek>
        <obrazek id="2"><![CDATA[Some text]]></obrazek>
        <obrazek id="3"><![CDATA[Some text]]></obrazek>
        <obrazek id="4"><![CDATA[Some text]]></obrazek>
        <obrazek id="5"><![CDATA[Some text]]></obrazek>
        <obrazek id="6"><![CDATA[Some text]]></obrazek>
        <obrazek id="7"><![CDATA[Some text]]></obrazek>
    </obrazki>

```

I,ve serched allredy a solution for this problem, and i tried to write the xml file again in Win8 notepad, in programs like EditPlus, and it didn’t solved it.

I also traced the `(URLLoader(event.target).data)` value from line: `xml1 = new XML(URLLoader(event.target).data);`  
And it traced me correct ale data from the Xml file.

Can anyone help?
