Note that there are some explanatory texts on larger screens.

plurals
  1. POParsing XML with AS3
    primarykey
    data
    text
    <p>Here is my entire Script as I can't seem to figure out where the problem is.</p> <p>The symptoms are that where I addChild(book) , is not the appropriate place for this to be added properly and sequentially with the thumbs as well. As a result, and to my surprise, the only way I can get these to appear so far is by writing a faulty trace statement which somehow pops them up in the top left corner. Any suggestions would be greatly appreciated! Thank you!!</p> <pre><code>var rowsW:Number; var my_xW:Number; var my_yW:Number; var my_thumb_widthW:Number; var my_thumb_heightW:Number; var my_imagesW:XMLList; var my_totalW:Number; var container_mcW:MovieClip; var preloaders_mcW:MovieClip; var book:TextField = new TextField(); var author:TextField = new TextField(); var publisher:TextField = new TextField(); book.selectable = true; var x_counterW:Number = 0; var y_counterW:Number = 0; var my_tweensW:Array = []; var container_mc_tweenW:Tween; var myXMLLoaderW:URLLoader = new URLLoader(); myXMLLoaderW.load(new URLRequest("WORKS.xml")); myXMLLoaderW.addEventListener(Event.COMPLETE, processXMLW); createContainerW(); callThumbsW(); function processXMLW(e:Event):void { var myXMLW:XML = new XML(e.target.data); rowsW = myXMLW.@ROWS; my_xW = myXMLW.@XPOSITION; my_yW = myXMLW.@YPOSITION; my_thumb_widthW = myXMLW.@WIDTH; my_thumb_heightW = myXMLW.@HEIGHT; my_imagesW = myXMLW.IMAGE; my_totalW = my_imagesW.length(); myXMLLoaderW.removeEventListener(Event.COMPLETE, processXMLW); myXMLLoaderW = null; } function createContainerW():void { container_mcW = new MovieClip(); container_mcW.x = my_xW; container_mcW.y = my_yW; addChild(container_mcW); preloaders_mcW = new MovieClip(); preloaders_mcW.x = container_mcW.x; preloaders_mcW.y = container_mcW.y; addChild(preloaders_mcW); } function callThumbsW():void { for (var i:Number = 0; i &lt; my_totalW; i++) { var thumb_urlW = my_imagesW[i].@THUMB; book.text = my_imagesW[i].@TITLE; author.text = my_imagesW[i].@AUTHOR; publisher.text = my_imagesW[i].@PUBLISHER; var thumb_loaderW = new Loader(); thumb_loaderW.load(new URLRequest(thumb_urlW)); thumb_loaderW.contentLoaderInfo.addEventListener(Event.COMPLETE,thumbLoadedW); thumb_loaderW.name = i; book.x = (40)*x_counterW; book.y = (my_thumb_heightW+40)*y_counterW; thumb_loaderW.x = (my_thumb_widthW+10)*x_counterW; thumb_loaderW.y = (my_thumb_heightW+10)*y_counterW; container_mcW.addChild(book); container_mcW.addChild(author); container_mcW.addChild(publisher); trace("my x equals" (book.x)); if (y_counterW+1 &lt; rowsW) { y_counterW++; } else { y_counterW = 0; x_counterW++; } var preloader_pbW:ProgressBar = new ProgressBar(); preloader_pbW.source = thumb_loaderW.contentLoaderInfo; preloader_pbW.x = thumb_loaderW.x; preloader_pbW.y = thumb_loaderW.y; preloader_pbW.width = my_thumb_widthW; preloader_pbW.height = my_thumb_heightW; preloaders_mcW.addChild(preloader_pbW); preloader_pbW.addEventListener(Event.COMPLETE, donePbW); } } function thumbLoadedW(e:Event):void { var my_thumbW:Loader = Loader(e.target.loader); container_mcW.addChild(my_thumbW); my_tweensW[Number(my_thumbW.name)]=new Tween(my_thumbW, "alpha", Strong.easeIn, 0,1,0.5, true); my_thumbW.contentLoaderInfo.removeEventListener(Event.COMPLETE, thumbLoadedW); } function donePbW(e:Event):void { var my_pbW:ProgressBar = ProgressBar(e.target); preloaders_mcW.removeChild(my_pbW); my_pbW.removeEventListener(Event.COMPLETE, donePbW); } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload