闪光灯释放时无法使用翻转

时间:2013-01-29 08:26:24

标签: flash actionscript-2

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

代码m使用

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

示例文件链接

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

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

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

非常感谢您的帮助

2 个答案:

答案 0 :(得分:1)

第一次尝试为你的movieclip创建一个简单的类并将你的控件放在那里。

例如:

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

答案 1 :(得分:1)

  1. 创建一个MovieClip,并为其命名为“button1”
  2. 将MovieClip公布为您想要的多个按钮,并将名称命名为“button2”“button3”等
  3. 创建另一个MovieClip,并将其命名为“main”,将其放入第1层,并将“Main”添加为instanceName
  4. 在“Main”MovieClip内添加两个按钮并添加“Button1”和“Button2”作为每个
  5. 的实例名称
  6. 为主要MovieClip创建一个类文件
  7. 将以下代码复制粘贴为类
  8. 或下载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;
                            }
                        }
                    }               
                }
            }
        }