<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml
"
layout="absolute" xmlns:ns1="html-template.*" xmlns:ns2="components.*" >
<mx:Script>
<![CDATA[
import mx.logging.AbstractTarget;
import flash.events.*;
import mx.events.*;
import mx.controls.*;
import flash.net.URLLoader;
import flash.net.URLLoaderDataFormat;
import flash.net.URLRequest
;
private var directory;
private function treeComplete(event:Event):void {
}
private function changeEvt(event:Event):void {
if (
[EMAIL PROTECTED] == true) {
directory = Tree(event.target).selectedItem;
}
else if (
[EMAIL PROTECTED] == false){
directory = Tree(event.target).selectedItem.parent();
}
}
/**** New File Button Handler *****/
private function newFile():void {
//create file
var new_file:Object = directory.appendChild(<Pfolder label="New File" isBranch="false"/>);
if([EMAIL PROTECTED] == true) //open folder automatically so you can see the new file
tree1.expandItem
(directory, true, true, false);
//????? Trying to get new file selected automatically--Not working
var length:int = new_file.children().length();
tree1.selectedItem = new_file.children()[length - 1];
trace("--\n\n" + new_file + "\n\n" + new_file.children() + "\n\n" + new_file.child(0));
}
]]>
</mx:Script>
<mx:XML source="file_list.xml" id="stuff"/>
<mx:Tree labelField="@label" x="18.5" y="10" width="153" height="192" id="tree1" editable="false"
change= "changeEvt(event);"
creationComplete="treeComplete(event)" >
<mx:dataProvider>
{stuff}
</mx:dataProvider>
</mx:Tree>
<mx:Button x="18.5" y="210" label="New File" click="newFile()" id="btnNewFile" enabled="true"/>
</mx:Application>
<?xml version="1.0" encoding="utf-8"?>
<folder label="Mail" isBranch="true">
<folder label="INBOX" isBranch="true"/>
<folder label="Personal Folder" isBranch="true">
<Pfolder label="Business" isBranch="false"/>
<Pfolder label="test" isBranch="false"/>
<Pfolder label="Personal" isBranch="true" />
<Pfolder label="Saved Mail" data="" blah blah" isBranch="true"/>
</folder>
<folder label="Sent" isBranch="true"/>
<folder label="Trash" isBranch="true"/>
</folder>
--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
Software development tool | Software development | Software development services |
Home design software | Software development company |
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe
__,_._,___