I am trying to create a link on a page that mimicks the existing flash nav开发者_Python百科igation and get it to work as expected, meaning that when you click the link, the site navigation reflects the change. The problem I'm having is that I don't understand the hierarchy since I'm working from outside the navigation system itself.
I can get the animation to change on rollOver and rollOut but when I click the link, the page changes from page1 to page2 but the navigation is still showing page1.
//This is the code in the existing navigation
onClipEvent (load) {
num=2;
_parent.t1.gotoAndStop(num);
}
on (rollOver) {
if (_root.link<>num) {
_parent.gotoAndPlay("s1");
}
}
on (releaseOutside, rollOut) {
if (_root.link<>num) {
_parent.gotoAndPlay("s2");
}
}
on (release) {
if (_root.link<>num and _root.animation ==1) {
_root.animation =0;
_root.link_prev = _root.link;
_parent._parent["item"+_root.link].gotoAndPlay("s2");
_root.link = num;
_root.play ();
}
}
//This is the code for my link outside the navigation.
//I've adjusted the rollOver and rollOut line to point to
//the specific link but the release remains a mystery to me.
//I'm not sure how to adjust it.
onClipEvent (load) {
num=2;
_parent.t1.gotoAndStop(num);
}
on (rollOver) {
_root.menu.item2.gotoAndPlay("s1");
}
on (rollOut) {
_root.menu.item2.gotoAndPlay("s2");
}
on (release) {
if (_root.link<>num and _root.animation ==1) {
_root.animation =0;
_root.link_prev = _root.link;
_parent._parent["item"+_root.link].gotoAndPlay("s2");
_root.link = num;
_root.play();
}
}
Thanks
I finally figured it out.
onClipEvent (load) {
num=2;
//Change following line from _parent.t1. to _root.menu.t1
_root.menu.t1.gotoAndStop(num);
}
on (rollOver) {
if (_root.link<>num) {
_parent.gotoAndPlay("s1");
}
}
on (releaseOutside, rollOut) {
if (_root.link<>num) {
_parent.gotoAndPlay("s2");
}
}
on (release) {
if (_root.link<>num and _root.animation ==1) {
_root.animation =0;
_root.link_prev = _root.link;
//change following line from _parent._parent to _root.menu
_root.menu["item"+_root.link].gotoAndPlay("s2");
_root.link = num;
_root.play ();
//Add this line also
_root.menu["item"+num].gotoAndPlay("s1");
}
}
精彩评论