Note that there are some explanatory texts on larger screens.

plurals
  1. POAS3 driving me nuts
    text
    copied!<p>Ok here is what I am currently trying to do. I have a class called vdata.as which takes 2 paramaters both are strings sent from the main stage. Parameter one is the location for an XML file that I need to open and read. The second parameter is the name of the video I am currently looking for.</p> <p>Now I can get the data from the XML file and display it with out any issue if its called from my class but when I try to access any of it from the stage I get undefined.</p> <pre><code>import flash.net.*; import flash.display.*; import flash.events.*; public class videoData { private var mName:String; private var mLink:String; private var mCategory:String; public static var elementArray:Array; // Constructor public function videoData(xmlPath:String,xmlVidSrc:String,pMC:MovieClip) { pXmlPath = xmlPath; pXmlVidSrc = xmlVidSrc; xmlloader = new URLLoader(); elementArray = new Array(); } public function getXML() { XMLData(); } private function XMLData() { xmlloader.load(new URLRequest(pXmlPath)); xmlloader.addEventListener(Event.COMPLETE,parseXMLData); } private function parseXMLData():void { var x:XML = new XML(xmlloader.data); Init(x); } private function Init(m:XML):* { var i:Number; for(i=0; i&lt;m.videos.videoname.length(); i++) { if(m.videos.videoname[i].@name == pXmlVidSrc) { videoData.elementArray.push(m.videos.videoname[i].@name); videoData.elementArray.push(m.videos.videoname[i].@category); videoData.elementArray.push(m.videos.videoname[i].link.@url); } } } </code></pre> <p>}</p> <p>When I call it from the main stage the code is as follows.</p> <p>var xData:videoData = new videoData(xmlPath,vidSrc,this); xData.getXML();</p> <p>then when I try to access any elements of videoData.elementArray they come up undefined... Im just smacking my head on my desk trying to figure this out any help would be great.</p>
 

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