Creating a Topic>Subtopic menu based on something similar to this...
hi,
i've been trying type of function working several days now, no avail. have xml document parsed in , i'm creating needed movie clips dynamically. issue having getting movie clips lined properly.
the resulting structure resemble this:
topic1
|
|--subtopic1
|
|--subtopic2
|
|--subtopic3
|
|--subtopic4
topic2
|
|--subtopic1
|
|--subtopic2
|
|--subtopic3
|
|--subtopic4
which created based on similar function:
function createxmlmenu(menulength:number):void{
//create dynamic menu based off
//menulength parameter being passed in
//i.e. - menulength = 2
for(var i:number=0;i<menulength;i++){
var mcmenuitem:mcmenu=new mcmenu();
//set menu item position
mcmenuitem.x=mcmenuholder.x;
//here's 1st troublesome lines
mcmenuitem.y= int(?);
//add menu item stage , flash.displaylist
addchild(mcmenuitem);
//create submenu
var xmlsubmenulength:number = 4;
if(xmlsubmenulength != 0){
for(var j:number=0;j<xmlsubmenulength;j++){
var mcsubmenuitem:mcmenu=new mcmenu();
var mc2attach2:movieclip = movieclip(mcmenuitem);
//add menu item stage , flash.displaylist
mc2attach2.addchild(mcsubmenuitem);
mcsubmenuitem.x=mcmenuholder.x+20;
//here's 2nd troublesome line
mcsubmenuitem.y= int(?);
}
}
}
}
per red lines, proper way create y coords topic , subtopic movie clips?
i hope makes sense. if doesn't make sense, please feel free let me know , try structure question differently.
thanks help,
~chipleh
:
var topicspace:uint=20;
var subtopicspace:uint = 10;
var nextbtny:uint = whatever;
function createxmlmenu(menulength:number):void{
//create dynamic menu based off
//menulength parameter being passed in
//i.e. - menulength = 2
for(var i:number=0;i<menulength;i++){
var mcmenuitem:mcmenu=new mcmenu();
//set menu item position
mcmenuitem.x=mcmenuholder.x;
//here's 1st troublesome lines
nextbtny+=topicspace;
mcmenuitem.y= nextbtny;
//add menu item stage , flash.displaylist
addchild(mcmenuitem);
//create submenu
var xmlsubmenulength:number = 4;
if(xmlsubmenulength != 0){
for(var j:number=0;j<xmlsubmenulength;j++){
var mcsubmenuitem:mcmenu=new mcmenu();
var mc2attach2:movieclip = movieclip(mcmenuitem);
//add menu item stage , flash.displaylist
mc2attach2.addchild(mcsubmenuitem);
mcsubmenuitem.x=mcmenuholder.x+20;
//here's 2nd troublesome line
mcsubmenuitem.y= nextbtny;
nextbtny+=subtopicspace;
}
}
}
}
More discussions in ActionScript 3
adobe
Comments
Post a Comment