1

ロールオーバー効果で作成したムービー クリップに行き詰まり、このムービー クリップ内にリンクを配置しましたが、問題はロールオーバーが機能することですが、リリース時には解決策がありませんか??

コード 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. ムービークリップを作成し、「button1」という名前を付けます
  2. そのムービークリップを必要な数だけ複製し、「button2」「button3」などの名前を付けます
  3. 別の MovieClip を作成し、「main」という名前を付けてレイヤー 1 に配置し、「Main」を instanceName として追加します。
  4. 「メイン」ムービークリップ内に 2 つのボタンを追加し、「ボタン 1」と「ボタン 2」をそれぞれインスタンス名として追加します。
  5. メイン MovieClip の Class ファイルを作成する
  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 に答える