action script on behalf of xml problem.

Posted by sabuj on Stack Overflow See other posts from Stack Overflow or by sabuj
Published on 2010-05-08T10:04:35Z Indexed on 2010/05/08 10:08 UTC
Read the original article Hit count: 222

Filed under:

import fl.transitions.easing.; import fl.transitions.;

var xml:XML; var xmlList:XMLList; var xmlLoader:URLLoader = new URLLoader (); var productLoader:URLLoader = new URLLoader();

var imageLoader:Loader; var bigImage:Loader = new Loader(); var imageText:TextField = new TextField();

xmlLoader.load(new URLRequest("http://localhost/shopmajik/flash/shopdata"));

xmlLoader.addEventListener(Event.COMPLETE, xmlLoaded);

function xmlLoaded(e:Event):void { xml=new XML(e.target.data); XML.ignoreWhitespace = true; xmlList = xml.children(); trace(xmlList);

imageLoader = new Loader();
imageLoader.load(new URLRequest(xmlList.elements("shopbanner").attribute("src")));
imageLoader.x = -220;
imageLoader.y = -187;
addChild(imageLoader);

}

imgLoader.alpha = 0;
textLoader.alpha = 0;
imgLoader2.alpha = 0;
imgLoader3.alpha = 0;
imgLoader4.alpha = 0;
imgLoader5.alpha = 0;

//Item button is working here...
btnProduct.addEventListener(MouseEvent.CLICK, showProduct); function showProduct(event:Event):void {
imgLoader.alpha = 0; textLoader.alpha = 0; imgLoader3.alpha = 0; imgLoader4.alpha = 0; imgLoader5.alpha = 0; imgLoader2.alpha = 0;

    var productLoader:URLLoader = new URLLoader();

    productLoader.load(new URLRequest("http://localhost/shopmajik/flash/productdata"));

    productLoader.addEventListener(Event.COMPLETE , onProductLoad);

    function onProductLoad(e:Event):void
    {
        var productLoader:XML = new XML(e.target.data);
        xmlList = productLoader.children();

        textLoader.text = xmlList.elements("productname");
        textLoader.alpha =0;
    }
}

//Item button is working here...
btnItem.addEventListener(MouseEvent.CLICK, showItem); //btnItem.addEventListener(Event:event, showItem); function showItem(event:Event):void

{   

        imgLoader.alpha =0;
        textLoader.alpha=0;
        imgLoader3.alpha=0;
        imgLoader4.alpha=0;
        imgLoader5.alpha=0;
        imgLoader2.alpha=0;

    var itemLoader:URLLoader = new URLLoader();
    itemLoader.load(new URLRequest("http://localhost/shopmajik/flash/productdata"));
    itemLoader.addEventListener(Event.COMPLETE , onItemLoad);
    function onItemLoad(e:Event):void
    {
        var myLoader:XML = new XML(e.target.data);
        xmlList = myLoader.children();
        textLoader.text = xmlList.elements("productname");
        textLoader.alpha =0;
    }
}

//Details button workings...
btnDetails.addEventListener(MouseEvent.CLICK, showDetails); function showDetails(event:Event):void {
imgLoader.alpha=0; textLoader.alpha=0; imgLoader3.alpha=0; imgLoader4.alpha=0; imgLoader5.alpha=0; imgLoader2.alpha=0;

    var detailsLoader:URLLoader = new URLLoader();
    detailsLoader.load(new URLRequest("http://localhost/shopmajik/flash/productdata"));
    detailsLoader.addEventListener(Event.COMPLETE , onDetailsLoad);
    function onDetailsLoad(e:Event):void
    {
        var myLoader:XML = new XML(e.target.data);
        xmlList = myLoader.children();
        textLoader.text = xmlList.elements("productdescription");
        textLoader.alpha =0;
    }
}

btnImages.addEventListener(MouseEvent.CLICK, showImages); function showImages(event:Event):void

{
    textLoader.alpha=0;
    textLoader.text="";
    imgLoader2.alpha= 1;
    var imagesLoader:URLLoader = new URLLoader();
    imagesLoader.load(new URLRequest("http://localhost/shopmajik/flash/productdata"));
    imagesLoader.addEventListener(Event.COMPLETE , onImagesLoad);
    function onImagesLoad(e:Event):void
        {
        var xml:XML = new XML(e.target.data);
        xmlList = xml.children();
        imgLoader2.x=-155;
        imgLoader2.y= -50;
        imgLoader2.load(new URLRequest(xmlList.elements("productimage").attribute("src")));
        }
    }

btnPay.addEventListener(MouseEvent.CLICK , showPage); function showPage(e:MouseEvent):void { navigateToURL(new URLRequest("https://www.paypal.com/")); }

This is the source code. It works very fine in locally. But in server it shows the bellow error ----

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

someone please show me the path. How i should go over this?

© Stack Overflow or respective owner

Related posts about actionscript-3