控制Flash导航的链接

时间:2010-07-19 13:17:47

标签: flash actionscript

我正在尝试在模仿现有Flash导航的页面上创建链接并使其按预期工作,这意味着当您单击链接时,网站导航会反映更改。 我遇到的问题是我不了解层次结构,因为我在导航系统外部工作。

我可以在rollOver和rollOut上更改动画但是当我点击链接时,页面会从page1更改为page2,但导航仍显示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();
        }
    }

由于

1 个答案:

答案 0 :(得分:0)

我终于明白了。

    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");
    }
}