_global.button = "";
_root.createEmptyMovieClip("navi_mc", 1);
function playForwards(timeline) {
if (timeline == undefined) timeline = this;
timeline.playBackwardsHelper.removeMovieClip();
timeline.play();
}
function playBackwards(timeline, to, loop) {
if (timeline == undefined) timeline = this;
var from = timeline._currentframe;
if (to == undefined || !(to > 0)) to = 1;
if (to > from) to = from;
if (loop == undefined) loop = 1;
timeline.playBackwardsHelper.removeMovieClip();
var helper = timeline.createEmptyMovieClip("playBackwardsHelper", timeline.getNextHighestDepth());
helper.onEnterFrame = function() {
if (timeline._currentframe > to) {
timeline.prevFrame();
} else {
if (loop) {
timeline.gotoAndStop(from);
} else {
delete this.onEnterFrame;
this.removeMovieClip();
}
}
}
}
function textfield(contentxml){
var XMLdaten = new XML();
XMLdaten.ignoreWhite=true;
XMLdaten.load(contentxml+".xml");
XMLdaten.onLoad = function(success) {
if(success){
anzahl = XMLdaten.firstChild.childNodes.length;
contenttext = [];
for (var i=0; i<anzahl; i++) {
contenttext[i] = XMLdaten.firstChild.childNodes[i].attributes.text;
this.createClassObject(mx.containers.ScrollPane, "textfield", 10);
textfield.setSize(150, 200);
var scrollListener:Object = new Object();
textfield.addEventListener("scroll", scrollListener);
var completeListener:Object = new Object();
textfield.addEventListener("complete", completeListener);
textfield.contentPath = contenttext[i];
}
}
}
}
var XMLdaten = new XML();
XMLdaten.ignoreWhite=true;
XMLdaten.load("navi.xml");
XMLdaten.onLoad = function(success) {
if(success){
anzahl = XMLdaten.firstChild.childNodes.length;
buttonnumber = [];
buttonname = [];
buttontarget = [];
contentstyle = [];
for (var i=0; i<anzahl; i++) {
buttonnumber[i] = XMLdaten.firstChild.childNodes[i].attributes.number;
buttonname[i] = XMLdaten.firstChild.childNodes[i].attributes.name;
buttontarget[i] = XMLdaten.firstChild.childNodes[i].attributes.target;
contentstyle[i] = XMLdaten.firstChild.childNodes[i].attributes.style;
navi_mc.attachMovie("button_mc", "button"+i+"_mc", i);
navi_mc["button"+i+"_mc"]._y = i*18;
navi_mc["button"+i+"_mc"].button_txt_mc.btnname.text = buttonname[i];
navi_mc["button"+i+"_mc"].button_btn.onRollOver = function (){
if(_global.button != this._parent){
playForwards(this._parent,1,0);
}
}
navi_mc["button"+i+"_mc"].button_btn.onRollOut = function (){
if(_global.button != this._parent){
playBackwards(this._parent,1,0);
}
}
navi_mc["button"+i+"_mc"].button_btn.onRelease = function (){
if(_global.button != this._parent){
playBackwards(_global.button,1,0);
playForwards(this._parent,1,0);
_global.button = this._parent;
if(contentstyle[i] == "textfield"){
textfield(buttontarget[i]);
}else if(contentstyle[i] == "portfolio"){
portfolio(buttontarget[i]);
}else if(contentstyle[i] == "contact"){
contact(buttontarget[i]);
}
}
}
}
}
}