在 Flash ActionScript 3.0 中将影片剪辑的链接提供给外部 url

发布于 2024-12-27 16:29:46 字数 1132 浏览 1 评论 0原文

我想将实例名称为 test1 的影片剪辑链接到外部网址(例如:http://www.google.com)

我正在使用一个菜单列表,其中主影片剪辑实例名称为“Primary_Menu”。在这个主影片剪辑中有 7 个菜单(主页、关于我们等),每个菜单都是影片剪辑并具有实例名称。 下面的代码用于将它们链接到各自的框架。但我需要提供最后一个菜单的外部网址(test1)

    Home_MC.logo_btn.addEventListener(MouseEvent.CLICK,ShowHome);
    Home_MC.Primary_Menu.pmenu_btn1.addEventListener(MouseEvent.CLICK,ShowHome);
    Home_MC.Primary_Menu.pmenu_btn2.addEventListener(MouseEvent.CLICK,ShowLocation);
    Home_MC.Primary_Menu.pmenu_btn3.addEventListener(MouseEvent.CLICK,ShowMasterplan);
    Home_MC.Primary_Menu.pmenu_btn4.addEventListener(MouseEvent.CLICK,ShowDesigner);
    Home_MC.Primary_Menu.pmenu_btn5.addEventListener(MouseEvent.CLICK,ShowAmenities);
    Home_MC.Primary_Menu.pmenu_btn6.addEventListener(MouseEvent.CLICK,ShowDevelopment);
    Home_MC.Primary_Menu.pmenu_btn7.addEventListener(MouseEvent.CLICK,ShowContact);
    Home_MC.Primary_Menu.pmenu_btn8.addEventListener(MouseEvent.CLICK,ShowLiving);
    Home_MC.Primary_Menu.test1.addEventListener(MouseEvent.CLICK,need to got to url here);

请建议!

I wanna link a movie clip which has instace name test1 to a external url (example: http://www.google.com)

I am using a menu list which has main movieclip instance name as 'Primary_Menu'. And inside this main movie clip there are 7 menus (home, about us etc..) each menus are movie clip and has instance names.
Below code is written for linking them to respective frames. but i need to give external url for last menu (test1)

    Home_MC.logo_btn.addEventListener(MouseEvent.CLICK,ShowHome);
    Home_MC.Primary_Menu.pmenu_btn1.addEventListener(MouseEvent.CLICK,ShowHome);
    Home_MC.Primary_Menu.pmenu_btn2.addEventListener(MouseEvent.CLICK,ShowLocation);
    Home_MC.Primary_Menu.pmenu_btn3.addEventListener(MouseEvent.CLICK,ShowMasterplan);
    Home_MC.Primary_Menu.pmenu_btn4.addEventListener(MouseEvent.CLICK,ShowDesigner);
    Home_MC.Primary_Menu.pmenu_btn5.addEventListener(MouseEvent.CLICK,ShowAmenities);
    Home_MC.Primary_Menu.pmenu_btn6.addEventListener(MouseEvent.CLICK,ShowDevelopment);
    Home_MC.Primary_Menu.pmenu_btn7.addEventListener(MouseEvent.CLICK,ShowContact);
    Home_MC.Primary_Menu.pmenu_btn8.addEventListener(MouseEvent.CLICK,ShowLiving);
    Home_MC.Primary_Menu.test1.addEventListener(MouseEvent.CLICK,need to got to url here);

Please suggest!!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

-黛色若梦 2025-01-03 16:29:46
for( var i:uint = 1;i< 10; i++)
{
    Home_MC.Primary_Menu["pmenu_btn"+i].addEventListener(MouseEvent.CLICK, action);
}
function action(e:MouseEvent):void
{
    switch(e.target.name){
        case "pmenu_btn9":
                //do action
                  navigateToURL(new URLRequest("url link"));
                break;
                default:
                break;
    }
}

重命名 pmenu_btn9 而不是 test1。然后运行。

for( var i:uint = 1;i< 10; i++)
{
    Home_MC.Primary_Menu["pmenu_btn"+i].addEventListener(MouseEvent.CLICK, action);
}
function action(e:MouseEvent):void
{
    switch(e.target.name){
        case "pmenu_btn9":
                //do action
                  navigateToURL(new URLRequest("url link"));
                break;
                default:
                break;
    }
}

rename pmenu_btn9 instead of test1. and then run.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文