:hr:
Hi there! So here’s my story! I have been stuck in this one thing for days now, so I am hoping one of you much smarter people than me can help me out!
I am creating a website for a design studio. The concept is to have an index on the main page of words that are related to their projects. So basically there are different entry ways to see one thing. For example you could see a book of art by clicking on “Books”, or clicking on “Art”, or clicking on “MoMa”.
The Index, is basically a huge menu. That’s how I look at it. The index is divided in 5 sections:
1.Project Categories
2. Project Names
3.Segment
4.Clients
5. Keywords
I have managed how to access each node of my Xml tree and extract the information I want. I have successfully stored the content from Project Categories into a variable called aCategory and flowed the elements from that array into a series of movies called McIndex1.mc0… McIndex1.mc1…
And here is where it gets fun! I can’t figure out how to flow the content from variable aProjects into the series mcIndex2.mc…; I tried to approach the same way I did aCategory and it only flows a couple of the elements. Help?
my Xml looks something like this:
project categories are the parent nodes. Inside each of the 7 categories (Books, brochures, Collateral, Custom Publishing, Editorial, Identity and Packaging) there are some nested nodes: Project name, segment, keyword and images).
Here is a small sample of how the <index> file looks (its huge)
<project_category title="Brochures">
<project_name title="9.11">
<segment title="Business"/>
<keywords title="Memoir"/>
<client name="Merrill Lynch"/>
<images>
<image source="images/911/911_c.jpg"/>
<image source="images/911/911_1.jpg"/>
<image source="images/911/911_2.jpg"/>
<image source="images/911/911_3.jpg"/>
<image source="images/911/911_4.jpg"/>
<image source="images/911/911_5.jpg"/>
<image source="images/911/911_6.jpg"/>
</images>
</project_name>
</project_category>
And here is my action script, please don’t laugh at me. This is the first time I am doing this… that last statement might be a little obvious
var index:XML = new XML();
index.ignoreWhite = true;
var project_category:XMLNode;
var project_name:XMLNode;
var segment:XMLNode;
var keyword:XMLNode;
var client:XMLNode;
var images:XMLNode;
var aCategory:Array;
var aProjects:Array;
var aSegment:Array;
var aKeyword:Array;
var aClient:Array;
var aImages:Array;
index.onLoad = function() {
var rootNode:XMLNode = this.firstChild;
var categories:Number = rootNode.childNodes.length;
for (i=0; i<categories; i++) {
project_category = rootNode.childNodes*;
var aCategory = project_category.attributes.title;
var mcText:Array = aCategory;
mcIndex1["mc"+i].t1.text = mcText;
mcIndex1["mc"+i].t1.setTextFormat(off);
mcIndex1["mc"+i].t1.selectable = false;
var projects:Number = project_category.childNodes.length;
for (p=0; p<projects; p++) {
var project_name:XMLNode = project_category.childNodes[p];
var aProjects = project_name.attributes.title;
mcIndex2["mc"+p].t1.text = String(aProjects);
mcIndex2["mc"+p].t1.setTextFormat(off);
mcIndex2["mc"+p].t1.selectable = false;
var segment:XMLNode = project_name.firstChild;
var aSegment = segment.attributes.title;
//trace(aSegment.toString)
var keyword:XMLNode = project_name.childNodes[1];
var aKeyword = keyword.attributes.title;
//trace(aKeyword)
var client:XMLNode = project_name.childNodes[2];
var aClient = client.attributes.name;
//trace(aClient)
}
}
};
index.load("index.xml");