[Flashcoders] Returning an XML Object

2006-03-01 Thread Peter Burke
Howdy folks,

Just trying to get my head wrapped around this issue.  In
photo_navigation.as, I'm trying to get back a return type of XML from
xml_loader.  But when I attempt this:  trace(my_xml =  + my_xml);, I end
up getting: my_xml = undefined.  Somewhere along the line I'm losing the
my_xml value in xml_loader.as because the value returned is empty.

I've been banging my head against this problem awhile now and need a second
or third opinion...



// Contents of xml_loader.as:
class xml_loader extends MovieClip {

// constructor
public function xml_loader() {
}

// public method to load the xml file
public function load_xml(xml_file:String) {
var myclass = this
// Create a local variable that points back to the current object
var thisObj:xml_loader = this;

// Create a local variable, which is used to load the XML file.
var my_xml:XML = new XML();

// Ignore whitespace
my_xml.ignoreWhite = true;

// Upon successful load of the xml file
my_xml.onLoad = function(success:Boolean) {
if (success) {
thisObj.init(my_xml);

// return the my_xml variable value
return my_xml;
} else {
trace(error loading XML);
return null;
}
};

// Begin loading the XML document.
my_xml.load(xml_file);
}

public function init(my_xml):Void {
// uncommenting the following line results in the xml being printed
correctly
// trace(my_xml);
}
}



// Contents of photo_navigation.as
class photo_navigation extends xml_loader {

// constructor
public function photo_navigation(xml_file:String) {
// take the xml_file string and pass it to the superclass
xml_loader
var my_xml = load_xml(xml_file);

// trace out the contents of my_xml
trace(my_xml =  + my_xml);
}
}



// Contents of photos.xml
albums
album url=album_001/ label=Album 001 index=0
photo url=photo_001.jpg label=Photo 001 index=0 /
/album
/albums


Thanks for any help you can give me!
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


[Flashcoders] no method with name 'createClassObject'.

2006-02-13 Thread Peter Burke
Hello,

I'm trying to create a button on-the-fly within a class declaration, but am
running into this error:

There is no method with the name 'createClassObject'.

--

Contents of Hint.as:

import mx.controls.Button;
class Hint extends MovieClip {

var hintTextBox:MovieClip;

function Hint() {

}

function init() {
var
mBox:Button=createClassObject(Button,myButton,1,{label:howdy});
}
}

--

Contents of hintTest.fla:

var myBut:Hint = new Hint();

--

Am I missing an import statement or am I extending the incorrect class?
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com