1

我被困在我制作的翻转效果的电影剪辑上,然后将链接放在这个电影剪辑中,现在问题是 onrollover 工作但在发布时没有任何解决方案?

代码 m 使用

on(release){
getURL("name.html")
}

示例文件链接

http://escribir.biz/nb1/sample.fla

http://escribir.biz/nb1/sample.swf

主盒子有翻转和滚动效果,链接在这部电影的第 2 层和第 1 层的盒子在实际电影中有很多这样的盒子有链接,但是当翻转工作时,发布时链接不起作用

非常感谢您的帮助

4

2 回答 2

1

第一次尝试为您的电影剪辑创建一个简单的类并将您的控件放在那里。

例如:

class YourMovieClipClassName extends MovieClip
{
    function YourMovieClipClassName() { super(); }
    function onLoad()
    {
        this.ControlMyMC();
    }
    function ControlMyMC()
    {
        this.onRollOver = function()
        {
            //Do on some
        }
        this.onRollOut = function()
        {
            //Do on some
        }
        this.onPress = function()
        {
            //Do on some
        }
        this.onRelease = function()
        {
            this.getURL("name.html");
        }
    }
}
于 2013-01-30T13:21:29.083 回答
1
  1. 创建一个 MovieClip 并将其命名为“button1”
  2. 复制该 MovieClip 尽可能多的按钮,并将名称命名为“button2”“button3”等
  3. 创建另一个 MovieClip 并将其命名为“main”,将其放入您的第 1 层,并将“Main”添加为 instanceName
  4. 在“Main”MovieClip 中添加两个按钮,并分别添加“Button1”和“Button2”作为 Instancename
  5. 为主影片剪辑创建一个类文件
  6. 将以下代码复制粘贴为类

或者下载examples.zip来查看http://www.comvos.net/downloads/examples.zip

    class main extends MovieClip
    {
        function main() { super(); }
        function onLoad()
        {
            this.ControlMyMC();
        }
        function ControlMyMC()
        {
            //Turn OFF the HandCursor of Main MC
            this.useHandCursor = false;

            this.onRollOver = function()
            {
                this["AnimatedBG"].gotoAndPlay(2);
                trace("RollOver Main MC");
            }

            this.onRollOut = function()
            {
                this["AnimatedBG"].gotoAndPlay(21);
                trace("RollOut Main MC");
            }

            var ButtonInstanceNames:Array = [
                                    "Button1",
                                    "Button2"
                                    ];


            for(var i:Number = 0; i < ButtonInstanceNames.length; i++)
            {

                this[ButtonInstanceNames[i]].onEnterFrame = function()
                {
                    if (this.hitTest(_root._xmouse, _root._ymouse, true))
                    {
                        //ROLL OVER BUTTON
                        if (!this.isRollOver) 
                        { 
                            this.isRollOver = true; 
                            trace("RollOver " + _name);
                        }
                    }
                    else
                    {
                        //ROLL OUT BUTTON
                        if (this.isRollOver) 
                        { 
                            this.isRollOver = false; 
                            trace("RollOut " + _name);
                        }
                    }
                }


                //ON RELEASE ---(if you want to use onPress .... just replace the onMouseUp wit onMouseDown
                this[ButtonInstanceNames[i]].onMouseUp = function()
                {
                    if (this.hitTest(_root._xmouse, _root._ymouse, true))
                    {
                        switch (_name)
                        {
                            case "Button1": trace("You Clicked on Button 1 ... replace me with --->   this.getURL(\"page1.html\");"); break;
                            case "Button2": trace("You Clicked on Button 2 ... replace me with --->   this.getURL(\"page2.html\");"); break;

                            //example
                            case "Button3": this.getURL("name.html"); break;
                            default: trace("aa"); break;
                        }
                    }
                }               
            }
        }
    }
于 2013-02-01T01:29:10.237 回答