Ask a Question related to Macromedia Flash Data Integration, Design and Development.
-
maija_g #1
XML loads properly in .SWF but not in .AS
I have the following script which works jim-dandy when implimented as a frame
script in my .swf, but I don't want it there, I want it in a class I've created
called FigureItem. I've stripped the script down to just the part that loads
the XML. When the script is inside the .swf (without the class constructor,
obviously) 'trace(contentXML)' correctly returns the formatted XML. Inside the
..as 'trace(contentXML)' returns 'undefined'. SOMETHING is loading becase
'trace("yay")' returns 'yay'. (loadXML gets called by the FiguireItem movie
clip inside the .swf).
class FigureItem extends MovieClip {
var rollBox:MovieClip;
var contentXML:XML;
//
public function FigureItem() {
contentXML = new XML();
}
public function loadXML(myURL:String):Void {
contentXML.onLoad = function(success:Boolean):Void {
if (success) {
trace ("yay");
trace(contentXML);
} else {
trace ("yay");
}
};
contentXML.load(myURL);
}
}
maija_g Guest
-
Webpage loads with the below error
:confused; Server Error in '/' Application. -------------------------------------------------------------------------------- Parser Error... -
sometimes my data loads, sometimes it doesn't :(
do it in creationComplete -
site loads slow
My site www.puroconjunto.com was created in Purlisher 2002. I had background music (since it is a music site) and the whole works. All of a... -
Preload while video loads
Hi, I have a flash file that contains a large video file and I am calling it into Director via loadmovie from another flash file already in... -
Help, page loads twice
I need help! A page I'm working on builds an HTML string based on a bunch of data in different tables and databases. Then it does a response.write... -
Raymond Basque #2
Re: XML loads properly in .SWF but not in .AS
contentXML is out of scope from the XML object;
Here are a few ways to deal with scope:
public function loadXML(myURL:String):Void {
var xmlOwner = this;
contentXML._OWNERREF = this;
contentXML.onLoad = function(success:Boolean):Void {
if (success) {
trace ("yay");
trace(this); // <===
trace(xmlOwner.contentXML); // <=====
trace(this._OWNERREF.contentXML); // <=========
} else { trace ("yay"); }
};
contentXML.load(myURL);
}
Raymond Basque Guest
-
maija_g #3
Re: XML loads properly in .SWF but not in .AS
Thanks, but that doesn't seem to work. I copied and pasted and immediately got
a pile of errors. I commented out all the stuff you added in until there were
no errors and then started uncommenting until I got an error. Below is the
first one.
class FigureItem extends MovieClip {
var contentXML:XML;
//
public function FigureItem() {
contentXML = new XML();
contentXML.onLoad = function(success:Boolean):Void {
if (success) {
trace ("yay");
//trace(this); // <===
//trace(xmlOwner.contentXML); // <=====
//trace(this._OWNERREF.contentXML); // <=========
} else {
trace ("booooo");
}
};
contentXML.load(myURL);
}
}
/**Error** blah/blah/blah/FigureItem.as: Line 11: There is no property with
the name '_OWNERREF'.
contentXML._OWNERREF = this;
*/
maija_g Guest
-
maija_g #4
Re: XML loads properly in .SWF but not in .AS
Never mind, the 'trace (this)' and 'trace (xmlOwner.contentXML)' both worked so I'll use one of those. Thanks!!
maija_g Guest



Reply With Quote

