操作脚本 2 - 发布时刷新,在翻转时不起作用



我卡在了我在翻转效果上制作的影片剪辑上,然后将链接放入此影片剪辑中现在的问题是滚动工作,但在发布时没有任何解决方案??

代码 M 使用

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

示例文件链接

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

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

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

非常感谢您的帮助

  1. 创建一个影片剪辑并为其命名"button1"
  2. 将电影剪辑配音为您想要的按钮数量,并命名为"按钮2"按钮3"等
  3. 创建另一个影片剪辑并为其命名"main",将其放入第 1 层中,并将"Main"添加为实例名称
  4. 在"主"影片剪辑中,添加两个按钮,并分别添加"Button1"和"Button2"作为实例名称
  5. 为主影片剪辑创建类文件
  6. 复制粘贴以下代码作为类

或下载示例.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;
                        }
                    }
                }               
            }
        }
    }

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

例如:

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

最新更新