Hi,
I accidentally stumbled into using flash for a project where php wasn't an option, unfortunately I've come to a point where i need to edit a little actionscript and it's beyond me.
the xml looks like this (i know it's stupid but it's already tied into some php parsing functions that would be irritating to rewrite!)
<project>
<project_1>
<name>Place name</name>
<other>sample</other>
</project_1>
<project_2>
<name>Place name</name>
<other>paragraph of text</other>
</project_2>
</project>
I'm trying to edit an interface from flash xml editor 2, below is the relevant code. I need to include the name text after the node name, so it would read project_2 Place name on the relevant tab in the editor. The edit i've attempted is commented. Any help would be greatly appreciated!
Tom
public class ClassicXMLNode extends MovieClip implements IEventDispatcher{
public var XMLData:XML;
public var isRoot:Boolean = false;
public var num:Number;
public var nodeName:String;
public var nodePath:String; // This will track the path throughout the XML document
public var childrenNodes:XMLList;
public var numNodes:uint;
public var childHolder:MovieClip;
public var isOpen:Boolean = false; // Tracks whether the nodes data is opened or closed
public static var moveDistance:Number; // This will be used for recursive loops : opening and closing sections
public function ClassicXMLNode(Data:XML, nodeNum:Number, xmlPath:String = null) {
XMLData = Data;
num = nodeNum;
xmlPath ? nodePath = xmlPath : nodePath = "";
nodeName = XMLData.name();
nodePath += "." + nodeName;
//trace(nodePath);
addEventListener(Event.ADDED_TO_STAGE, addedListener);
}
public function addedListener(e:Event):void {
//I added the var project
var project:String = XMLData.project*.name.text();
//Load the XMLData
//and tried to concatenate it here
nodeName_txt.text = XMLData.name + project();
childrenNodes = XMLData.children();
numNodes = childrenNodes.length();
//Create the holder for childNodes
childHolder = new MovieClip();
childHolder.y = ClassicTree.nodeSpacing;
childHolder.x = 50;
addChild(childHolder);
// Event Listeners
openButton.buttonMode = true;
openButton.tabEnabled = false;
openButton.addEventListener(MouseEvent.CLICK, _click);
numNodes == 0 ? openButton.visible = false : null;
this.addEventListener(MouseEvent.MOUSE_OVER, hideActionMenu);
this.addEventListener(MouseEvent.MOUSE_OUT, hideActionMenu);
hideActionMenu();
moveButtonCheck();
}