Ok, so I have a tree loaded into flash which loads great.
NOW!!! My task is to load xml content from the loaded Tree.xml into a component that sits on my stage which is call "my_loader"
Can anyone guide me on how to load the XML content into the "my_loader" component from the loaded Tree.xml?
Up until now I have just loaded seperate movies onto the stage ... What I really want is one base movie and the rest to be dynamically controlled via XML.
Any help would be highly appreciated .... Maybe even a FLA and XML example if you can spare time or have worked with something similar.
can you clarify -
1 - Flash version you are using
2 - you are using a Tree component ? How are you loading it ? What code ?
3 - what kind of component is "my_loader" ?
4 - what is the structure of Tree.xml ?
can you clarify -
1 - Flash version you are using
2 - you are using a Tree component ? How are you loading it ? What code ?
3 - what kind of component is "my_loader" ?
4 - what is the structure of Tree.xml ?
OK, thanks for the reply .. here's what I'm trying. I could be way out.
1 - Flash 8
2 - Tree Code - Merely just a modified Flash 8 tree component
var my_tree:mx.controls.Tree;
var treeDP_xml:XML = new XML();
treeDP_xml.ignoreWhite = true;
treeDP_xml.onLoad = function(success:Boolean) {
if (success) {
my_tree.dataProvider = this.firstChild;
}
};
treeDP_xml.load("Tree.xml");
var treeListener:Object = new Object();
treeListener.change = function(evt:Object) {
var treeNode:XMLNode = evt.target.selectedItem;
if (treeNode.attributes.src != undefined) {
my_loader.load(treeNode.attributes.src);
}
};
my_tree.addEventListener("change", treeListener);
my_tree.addEventListener("change", treeListener);
var lo = new Object();
lo.change = function (event_obj)
{
var tree = event_obj.target;
var sel_tn = tree.selectedNode;
if (tree.getIsBranch(sel_tn))
{
var nodeAlreadyOpen_bool = tree.getIsOpen(sel_tn);
tree.setIsOpen(sel_tn,!nodeAlreadyOpen_bool);
}
}
my_tree.addEventListener('change',lo);
3 - My_loader component is the Flash 8 mx.controls.Loader (which could be better I'm sure, if you've a suggestion). I just need something that can load text and images.
4 - The Tree.xml code is this (which works in one instance, but will need to be addressed for two areas, this is where I'm in a daze:
I really need to get this going, so if you can suggest a modification or an alternative that would be really helpful.
Here's hoping!!
To add. If I add a second instance of:
treeDP_xml.load("instruct_tree.xml");
var treeListener:Object = new Object();
treeListener.change = function(evt:Object) {
var treeNode:XMLNode = evt.target.selectedItem;
if (treeNode.attributes.src != undefined) {
my_loader2.load(treeNode.attributes.src);
}
};
Changing the my_loader to my_loader2, it kinda works.... Both fields are actually filled now, but unfortunately with the same content .... So the idea is kinda there, I just need to get it so the 2 components load 2 different content.
on my stage i have -
Tree component - my_tree
Loader component - my_loader
i have 2 xml files - Tree.xml and section1.xml
section1.xml is a simple reference to a jpg - image1.jpg
PHP Code:
<?xml version="1.0"?>
<node>image1.jpg</node>
selecting Section1 - section1 content1 in the Tree will
send the xml file attribute to a new XML object.
the new object will parse the file parameter
and load the image into the Loader component.
Note - Loader component can only display a SWF or JPEG file
PHP Code:
var my_tree:mx.controls.Tree;
var treeDP_xml:XML = new XML();
treeDP_xml.ignoreWhite = true;
treeDP_xml.onLoad = function(success:Boolean) {
if (success) {
my_tree.dataProvider = this.firstChild;
}
};
treeDP_xml.load("Tree.xml");
var treeListener:Object = new Object();
treeListener.change = function(evt:Object) {
var treeNode:XMLNode = evt.target.selectedItem;
if (treeNode.attributes.src != undefined) {
loadContent(treeNode.attributes.src);
}
};
my_tree.addEventListener("change", treeListener);
function loadContent(file){
_xml = new XML();
_xml.ignoreWhite = true;
_xml.load(file);
_xml.onLoad = function(){
image = this.firstChild.childNodes; trace(image);
my_loader.load(image);
};
};
However, I'm similar to a modified fish, in that I'm like a fish out of water ...
Can I upload the files and maybe you can take a look?
It should take you less time than it would take to boil an ostrich egg ;o)
I just need the tree to be there working, with two things on the stage that can accept xml files with mixed content etc... I'm sure you get my drift ;o)
I've no space to upload these files, can I do it directly on the board?
The thing is, I need it to load XML and not swf ...with the component I have you already said it would only hold swf or jpg files.
I just need two holders on the stage that I can load XML into and not swf. One section click to load two XML files into two dofferent areas as it were. Left and right content.
The XML in question will have a mixture of Images and Text .... It does work fine with loading flash files, but it's the XML I need it to load. So theres only one movie to edit, the rest being dynamically driven with XML.
So, to sum up. Load the tree, have 2 instances on the stage that I can load an XML file for each into from one section click.
I'm sure it's a simple thing to do if you know what you're doing, however, I'm clearly as thick as a malteser on a holiday to margate.
Help me Obi-Wan Kenobi, you're my only hope.
I'm not overly great at explaing things I know. For that I apologise, but if you could help me out, I'll need the following:
1) Change the tree code to be able to load XML content from the tree insrtead of SWF. Which may already work if the component is changed to accept XML on the stage.
2) Change the holder (component) on the stage into two components that actually load the two XML files into it and not be limited to swf and jpg.
3) Create two ultra simple xml file with an image and a bit of text in it. Purely just to show it works when xml is called.
I hope I've explained that ok.
Thanks dog. I'll sort you out with a little food if I can ;o)
to prevent me barking up the wrong Tree, is this scenario correct ?
load Tree from xml
click in tree to load secondary xml
secondary xml points to image/text
if so, please provide -
the main.xml file that loads into Tree component (with xml links, not swf as above)
an example of the xml file that contains the text and image
Absolutely spot on ...
The main xml you have, all you'll need to do is change the swf to xml. It doesn't matter how it works, I just need a working example really. I don't actually have the text and image xml working properly, so it might be easier if you could just do a simple one that I can see working and then adjust accordingly.
Someone else is actually going to be doing all the XML files content, I just need to provide them with the template as it were. Hope this makes sense?
Great idea, but from what I can gather there will be ALOT of XML files .... Probably over 1000 ....Could be less, could be more.
Hence why I just need the core to work ...
Originally I just thought of doing an SWF for all the seperate XML files, until I heard just how much content this could have over the next few years, lol...
Therefore Mr Dog sir, if you could bail me out on this one the earth where you tread would be kissed ;o)
Ooh, and we've lost the open command if you click on the actual section. Only the arrows open the section. Oh, and the clips on the stage seem to be buttons that close the menu, which I don't really want.
Fear not, I will leave you alone soon dog ;o) I do apologise.
I am now off on a hunt to find out how to get rid of the border and whitespace from the TextArea component ;o)
Woo Hoo, just got rid of the border, just the background colour to remove now ;o)
Am looking for a way to put a dividing line in between sections.... Impossible to find ... borderStyle and borderColor were a doddle, but getting a line in between the sections seems impossible.
Also, off hand, you don't have any idea how I can use and accordion effect do you? as in, when one section opens the other closes? .... Oh, and the smooth sliding thing.
I take it the image/text content isn't possible then?