My xml navi problem

admin

Administrator
Staff member
Hi board,

Im very new to xml and have been basing my vavigation on a template i found.

<!-- m --><a class="postlink" href="http://www.ssradiouk.com/test/SITE.html">http://www.ssradiouk.com/test/SITE.html</a><!-- m -->

<!-- m --><a class="postlink" href="http://www.ssradiouk.com/test/menu.fla">http://www.ssradiouk.com/test/menu.fla</a><!-- m -->

I was wondering if anyone could help me with the following:

I would like to edit the code so that the sub menu only drops down when you click on that menu item (at the moment it drops down when you roll over it)

I would like to also know where in the xml file i have to put my http:// links. (at the moment I have put three in but they do not know where they need to go)

Any help at all would be fantastic people.

Dave

My XML Code......


<menu>
<menuItem label="Home">
</menuItem>
<menuItem label="Listen">
<sub label="Default Player" data=http://www.webdeveloper.com/forum/archive/index.php/"http://212.72.165.25:9024/listen.pls"/>
<sub label="Windows Player" data="http://212.72.165.25:9024/listen.m3u"/>
<sub label="Real Player" data="http://212.72.165.25:9024/listen.rm"/>
</menuItem>
<menuItem label="Schedule">
<sub label="Sunday" data="......."/>
<sub label="Monday" data="......."/>
<sub label="Tuesday" data="........"/>
<sub label="Wednesday" data="....."/>
<sub label="Thursday" data="......"/>
<sub label="Friday" data="......"/>
<sub label="Saturday" data="......"/>
</menuItem>
<menuItem label="Events">
</menuItem>
<menuItem label="Gallery">
</menuItem>
<menuItem label="Forums">
</menuItem>
<menuItem label="Links">
</menuItem>
<menuItem label="Contact">
</menuItem>
</menu>




My action script......pt 1


this._lockroot = true;

itemClass.prototype = new MovieClip();
Object.registerClass("item",itemClass);

function itemClass(){
this.open = false;
itemOpen = undefined;
}

itemClass.prototype.init = function(i){
this.mc = _root.menu.attachMovie("item","item"+i,10*i);
}

itemClass.prototype.onEnterFrame = function(){

if(this.quel() <= itemToOpen){
this.seek = this.park;
}else if(this.quel() > itemToOpen){
this.seek = this.park + distance;
}else{

}
this.goEase(this.seek,6);
}

itemClass.prototype.onRollOver = function(){

if(this.open){
itemToOpen = undefined;
itemToClose = this.quel();
}else{
itemToOpen = this.quel();
itemToClose = undefined;
}
distance = this.distance ;
}

itemClass.prototype.onRollOut = function(){
itemToOpen = Infinity;
}

itemClass.prototype.quel = function(){
return Number(this._name.slice(4));
}

itemClass.prototype.goEase = function(target,speed){
this._y = this._y + (target - this._y)/speed;
if(Math.abs(this._y-target) < 0.8)this._y = target;
}



My action script......pt 2


menuClass.prototype = new MovieClip();
function menuClass(){
this = _root.attachMovie("menu","menu",0);
this._visible = false;
this._data = new XML();
this._data._parent = this;
this._data.ignoreWhite = true;;
this._data.load("menu.xml");
this._data.onLoad = parseMenu;
this.init();
}

Object.registerClass("menu",menuClass);

parseMenu = function(){
nbChilds = this.firstChild.childNodes.length;
//for(var i=0;i<nbChilds+1;i++){
for(var i in this.firstChild.childNodes){
temp = new itemClass();
temp.init(i);
itemMc = temp.mc;
itemMc._y = 20*i;
itemMc.park = 20*i;
itemMc.label = this.firstChild.childNodes.attributes.label;

for(var j=0;j<this.firstChild.childNodes.childNodes.length;j++){
itemMc.attachMovie("sub","sub"+j,10*j);
itemMc["sub"+j]._y = 20 + 20*j;
itemMc["sub"+j].toto = this.firstChild.childNodes.childNodes[j].attributes.label;
}
itemMc.distance = j*20;
}
var temp = new itemClass();
temp.init(this.firstChild.childNodes.length);
var itemMc = temp.mc;
itemMc._y = 20*this.firstChild.childNodes.length;
itemMc.park = 20*this.firstChild.childNodes.length;

this._parent._visible = true;
}

menuClass.prototype.init = function(){
this.attachMovie("mask","mask",300);
with(this.mask){
_y = -1
_height = _root.menu.item8._y;
_width = 101;
}

this.createEmptyMovieClip("topEdge",203);
with(this.topEdge){
lineStyle( 0.50, 0x000000, 100 );
moveTo( 0,0);
lineTo(100,0);
}
this.setMask(this.mask)
}

menuClass.prototype.onEnterFrame = function(){

this.mask._height = this.item8._y+2;

this.createEmptyMovieClip("leftEdge",200);
with(this.leftEdge){
lineStyle( 0.00, 0x000000, 100 );
moveTo( 0, 0 );
lineTo( 0,this.item8._y );
}

this.createEmptyMovieClip("rightEdge",201);
with(this.rightEdge){
lineStyle( 0.00, 0x000000, 100 );
moveTo( 100, 0 );
lineTo( 100,this.item8._y );
}

this.createEmptyMovieClip("bottomEdge",202);
with(this.bottomEdge){
lineStyle( 0.00, 0x000000, 100 );
moveTo( 0,this.item4._y );
lineTo( 100, this.item4._y);
}
}

myMenu = new menuClass();my navi (<!-- m --><a class="postlink" href="http://www.ssradiouk.com/test/SITE.html">http://www.ssradiouk.com/test/SITE.html</a><!-- m -->)
 
Back
Top