Hi I have downloaded an XML/Flash Menu, and customized it a bit and it works great, but i want to add some more functionality, (unfortunaly its way over my head, im just a lowlevel flasher on the script side, and XML is quite new to me, very very insteresting though and its gonna be my next thing to really explore)
1:
HOW is it possible to add functionality to the XML so it will act just like
_root_gotoAndStop(“lable1”); would do in flash?
meaning i want to add function to the links in the XML so it can jump to a frame or frameLable i flash via the XML input…
My flash file is 1 file, 5 frames (with stop(); actions (each frame 1 menu point) - and no serious scripting the one “special” thing is a news section
which load content fra an XML file. there on LoadMovies or anything that might complicate things.
2: I also want to ad a simple getURL function to the XML
(this could actually be fixed just witha frameaction inside flash IF question 1 i possible) basically i just want a link to work as the getURL(url [, window [, “variables”]])
anyway the MAIN question is HOW do i add the gotoAndPlay function in the script pasted here below:
(as said my AS and XML is quite pathetic so be gentle)
HERE THE FLASH CODE:
FRAME1 Code In flash:
import it.sephiroth.TreeDnd
// set some style to the component
var theTree:mx.controls.Tree = dnd.getTree();
theTree.setStyle(‘fontFamily’,‘font1’)
theTree.setStyle(‘fontSize’,8);
theTree.setStyle(‘embedFonts’, true);
theTree.setStyle(‘backgroundColor’,‘0xFFFFFF’);
theTree.setStyle(‘rollOverColor’,‘0xE9E9F3’);
theTree.setStyle(‘selectionColor’,‘0xBCCCDF’);
theTree.setStyle(‘textSelectedColor’,‘0xFFFFFF’);
theTree.setStyle(‘openDuration’, 100);
theTree.setStyle(‘selectionDuration’,0);
theTree.setStyle(“disclosureClosedIcon”, “iconPlus”)
theTree.setStyle (“disclosureOpenIcon”,“iconMinus”);
dnd.setStyle(“separatorColor”, ‘0xFF0000’);
theTree.rowHeight = 20;
theTree.vScrollPolicy = “auto”
theTree.iconFunction = function(item){
if( this.getIsBranch(item)){
return “folder_icon”
} else {
return “node_icon”
}
}
// define event listener
var dndList:Object = new Object();
dndList.double_click = function(evt:Object)
{
testo.text = evt.type
}
dndList.drag_start = function(evt:Object)
{
testo.text = evt.type
}
dndList.drag_fail = function(evt:Object)
{
testo.text = evt.type
}
dndList.drag_complete = function(evt:Object)
{
trace(‘drag complete’)
testo.text = evt.type
}
dndList.drag_target = function(evt:Object)
{
trace(‘drag_target’)
evt.targetMc.text = "Dropped: " + evt.sourceNode
}
// ***********************************
// set the event listeners
// ***********************************
this.dnd.addEventListener(‘double_click’, dndList);
this.dnd.addEventListener(‘drag_start’, dndList);
this.dnd.addEventListener(‘drag_fail’, dndList);
this.dnd.addEventListener(‘drag_complete’, dndList);
this.dnd.addEventListener(‘drag_target’, dndList); // when an item is dropped over a defined target
this.dnd.dropTarget = [testo] // defined a drop target
/**
you can define also custom drag and drop functions
this.dnd.dragFunction = function(item:XMLNode){
// return if item can be dragged
return true;
}
this.dnd.dropFunction = function(source:XMLNode, target:XMLNode){
// return if dragged item can be dropped into the target item
return true
}
**/
// ***********************************
// Now load an XML into Tree component
// ***********************************
var _xml:XML = new XML();
_xml.ignoreWhite = true
_xml.onLoad = function(){
dnd.getTree().dataProvider = this.firstChild
}
_xml.load(“example.xml”);
FRAME1 Code (different layer) In Flash:
import it.sephiroth.TreeDnd
var check_listener:Object = new Object();
check_listener.click = function(evt:Object){
var data:String = evt.target.label
var obj_string:Number = 0
if( data == ‘DEFAULT’ or data == ‘DENYALL’)
{
for(var a = 0; a < 6; a++)
{
if( evt.target.parent['cb’ + a] != evt.target)
{
evt.target.parent['cb’ + a].selected = false
}
}
} else {
evt.target._parent.cb_0.selected = false
evt.target._parent.cb_1.selected = false
}
for(var a = 0; a < 6; a++){
if( evt.target.parent['cb’ + a].selected == true){
obj_string |= TreeDnd[evt.target.parent['cb’ + a].label]
}
}
trace(obj_string)
evt.target._parent.dnd.dragRules = obj_string
trace( evt.target._parent.dnd.dragRules )
}
this.cb_0.addEventListener(‘click’, check_listener);
this.cb_1.addEventListener(‘click’, check_listener);
this.cb_2.addEventListener(‘click’, check_listener);
this.cb_3.addEventListener(‘click’, check_listener);
this.cb_4.addEventListener(‘click’, check_listener);
this.cb_5.addEventListener(‘click’, check_listener);
for(var a = 0;a < 6; a++){
this[‘cb_’ + a].setStyle(‘fontFamily’,‘font1’)
this[‘cb_’ + a].setStyle(‘fontSize’,8);
this[‘cb_’ + a].setStyle(‘embedFonts’, true);
}
testo.setStyle(‘fontFamily’,‘font1’)
testo.setStyle(‘fontSize’,8);
testo.setStyle(‘embedFonts’, true);
And here is the XML:
<?xml version=“1.0” encoding=“iso-8859-1”?>
<node data=“id=1” label=“Welcome - website” icon=“folderYellowClosed”>
<node isOpen="" data=“id=233” label=“HOVEDMENU1”>
<node data=“id=245” label=“SUB1_0”/>
<node data=“id=245” label=“SUB1_1”/>
<node data=“id=245” label=“SUB1_2”/>
<node data=“id=245” label=“SUB1_3”/>
<node data=“id=245” label=“SUB1_4”/>
</node>
<node isOpen="" data=“id=305” label=“HOVEDMENU2”>
<node data=“id=621” label=“SUB2_1”/>
<node data=“id=625” label=“CSUB2_2”/>
<node data=“id=621” label=“SUB2_3”/>
<node data=“id=625” label=“SUB2_4”/>
<node data=“id=625” label=“SUB2_5”/>
<node data=“id=621” label=“SUB2_6”/>
<node data=“id=625” label=“SUB2_7”/>
</node>
<node isOpen="" data=“id=325” label=“HOVEDMENU3”>
<node data=“id=329” label=“SUB3_1”/>
<node data=“id=333” label=“SUB3_2”/>
<node data=“id=337” label=“SUB3_3”/>
</node>
<node isOpen="" data=“id=369” label=“HOVEDMENU4”>
<node data=“id=373” label=“SUB4_1”/>
<node data=“id=377” label=“SUB4_1”/>
</node>
please please
i have tried downloading dozens of flash/xml files to learn more but i have not been able to overcome this issue)