can't help with lines or accordian, sorry
for image/text content in a TextArea, use html tags
PHP Code:
var my_ta:mx.controls.TextArea;
var image:String = "Seeds.jpg";
var heading:String = "Seeds Enterprise";
my_ta.setSize(320, 240);
my_ta.html = true;
my_ta.text = "<img src='"+image+"'>";
my_ta.text += "<p align='right'><b>"+heading+"</b>"+
"<br><br><p align='center'>This is a simple example of "+
"loading <br><b>text</b> and an <i>image</i> into an html"+
" enabled <font color='#FF0000'>TextArea</font> Component";
Still no luck with the divider between coloured sections, However, I'm get closer to the accordion effect.... The only snag is, that the menu pops down but looks like it adds another menu option when it opens, goes away though.... And the text doesn't keep up with it .... Oh, and the menu doesn't close the previous section when the new section is selected.
Anyhoo, here's the code ... What am I doing wrong? I'm almost there with the look and feel of the menu.
//create a new listener to catch click on tree node
myTreeListener = new Object();
// change event handler
myTreeListener.change = function(eventObject)
{
// the selected node
var theSelectedNode = eventObject.target.selectedNode;
//if it's a branch (a folder) so the branch is open
if(my_tree.getIsBranch(theSelectedNode)){
//Note: remove the last boolean optionnal parameter if you won't have an animated transition
my_tree.setIsOpen (theSelectedNode, true,true,true);
}
}
// add eventHandler to your listener
my_tree.addEventListener("change", myTreeListener);
can't help with lines or accordian, sorry
for image/text content in a TextArea, use html tags
PHP Code:
var my_ta:mx.controls.TextArea;
var image:String = "Seeds.jpg";
var heading:String = "Seeds Enterprise";
my_ta.setSize(320, 240);
my_ta.html = true;
my_ta.text = "<img src='"+image+"'>";
my_ta.text += "<p align='right'><b>"+heading+"</b>"+
"<br><br><p align='center'>This is a simple example of "+
"loading <br><b>text</b> and an <i>image</i> into an html"+
" enabled <font color='#FF0000'>TextArea</font> Component";
Will that work via XML though? I'll give it a shot, but I thought the XML would need to format it for flash to read it.
Instead of loading the text on the first frame, I need to be able to keep the formating from the code you so kindly gave me earlier. Which was:
Code:
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) {
trace(treeNode.attributes.src)
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.attributes.img; trace(image);
txt = this.firstChild.attributes.txt; trace(txt);
my_loader.load(image);
my_ta.text = txt;
};
};
The code above works a treat for simple XML tags which you've done, using IMG and TXT .... However, when I load the following XML, it doesn't want to know...:
Code:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<page>
<header><p>Orographic Triggers</p></header>
<spacer><p>-</p></spacer>
<section>
<sectionhead><li>What are orographic triggers?</li></sectionhead><subsection><p>If the air mass is absolutely unstable any rising ground will trigger immediate convection, which will continue on up, forming cloud, when the rising air cools to its dew point. If the air is very dry, cloud may never form, but the convection will still be present. Glider pilots call this "blue thermals". If the air is absolutely stable, then no matter how high the mountains, the air will sink back down on the lee side, and there will be no convection.</p></subsection></section><spacer><p>-</p></spacer><section><sectionhead><li>How do orographic triggers effect conditionally unstable air?</li>
</sectionhead>
<subsection><p>The illustration shows the condition of rising air against an ELR of about 2 degrees C/1000ft.If the air was forced to rise and keep on rising it would cool first at the DALR until it reaches its dew point, and then cloud would begin to form If it is forced to rise further it cools at the SALR. It is not yet unstable</p>
</subsection>
</section>
</page>
If it's at all possible, could you possible adjust your original code so that I can keep the formatting of the XML .... I figure that if I can get the style looking great by loading the XML on the first frame, there must be a way I can keep the style by clicking a menu option.
Please help sir, I have just 4 hairs left and would rather just get this out of the way so I can have some kind of life.
Sorry, this is the full code of the XML file.... Post was too long I think:
Code:
<page>
<header><p>Orographic Triggers</p></header>
<spacer><p>-</p></spacer>
<section>
<sectionhead><li>What are orographic triggers?</li></sectionhead>
<subsection><p>If the air mass is absolutely unstable any rising ground will trigger immediate convection, which will continue on up, forming cloud, when the rising air cools to its dew point. If the air is very dry, cloud may never form, but the convection will still be present. Glider pilots call this "blue thermals". If the air is absolutely stable, then no matter how high the mountains, the air will sink back down on the lee side, and there will be no convection.</p></subsection>
</section>
<spacer><p>-</p></spacer>
<section><sectionhead><li>How do orographic triggers effect conditionally unstable air?</li></sectionhead>
<subsection><p>The illustration shows the condition of rising air against an ELR of about 2 degrees C/1000ft.If the air was forced to rise and keep on rising it would cool first at the DALR until it reaches its dew point, and then cloud would begin to form If it is forced to rise further it cools at the SALR. It is not yet unstable</p></subsection>
</section>
</page>
Yesterday 5:08 post
please explain where you wish this xml file to load
to the Tree ? (not poss. with html tags)
to the TextArea ? (poss. with code mods)
you want the <p> and <li> tags maintained ?
Yes, in the text area please.... And to keep the formatting if you can .... As I say, the first frame on load works great for the text area with the formatting etc ....
So, if you get that going and also let me keep control of loading the XML images that would be great ....
Basically it needs to consist of one XML file loading into my_ta and one xml file loading into my_ldr all from the tree xml menu.....
Man, if you can sort this out that would be SO cool .....
Dog, that works a treat, but as you have already guess, I'm as thick as two short planks ....
Where would I put this code? In the action keyframe where the tree is loaded? Over the code ou originally gave me?
You've got the action calling the page.xml, so how would that work in conjunction with the tree I need loaded.
The styling too is CSS based, which I've called in the first frame, so I'm guessing I can't use that? Which is a bit of a bind as the guy who is writing the XML, is going to be working from the simple XML template I finally provide ...
Also, how does this effect the image loading into my_ldr ....
I know I'm a pain dog, but I've been on this 2 weeks now and it really is getting me down.
I'm tempted just to create a movie clip with 10,000 keyframes and just load the XML files individually via the keyframe , LOL.....
Sorry for being a pain mate, and for being an idiot ..... I really thought this would be a simple thing to do ...
Is there not just a script I can use to change the content much like before?
As I say, when using OnLoad, the XML loads in perfectly ... It's just this bloody tree, which I refuse to work with again.
Network Error (tcp_error)
A communication error occurred: ""
The Web Server may be down, too busy, or experiencing other problems preventing it from responding to requests. You may wish to try again at a later time.
Sorry but i have little time for downloading fix-em-ups
can you not modify all of the info supplied so far ??
I will try obviously .... But if you could also take a look over the weekend or when you have a little time just in case I can't fix it that'd be great.
I can smell the finish and it's exciting I can tell you .....
took a quick look in my tea-break
File cannot find - distance.css
you have not implemented CDATA in xml files
to clear previous text - frame#29, line#26
function loadContent(file){
my_ta.text = "";
....
};
took a quick look in my tea-break
File cannot find - distance.css
you have not implemented CDATA in xml files
to clear previous text - frame#29, line#26
function loadContent(file){
my_ta.text = "";
....
};
My bad on the CDATA .,... I'm an idiot I know .... Totall forgot about that .... Too tired.
Yes, still loads in lovely .... However, whenever I click a second file to load into it (just duplicated section1.xml etc ...) It just adds to the textArea instead of replacing it.
Also, the onload no longer works, but that's not really an issue ... I can work around that with content.....