使用 AS3 在 Flash 中导航。代码不起作用

发布于 2024-12-23 02:36:08 字数 557 浏览 1 评论 0原文

我的导航代码无法正常工作。我对动作脚本不太精通,有人能指出我做错了什么吗?提前致谢

//nav
var home:int = 1;
var about:int = 2;
var projects:int = 3;
var press_id:int = 4;
var contact:int = 5;

home_mc.addEventListener(MouseEvent.CLICK, home);
about_mc.addEventListener(MouseEvent.CLICK, about);
projects_mc.addEventListener(MouseEvent.CLICK,projects);
press_mc.addEventListener(MouseEvent.CLICK, press_id);
contact_mc.addEventListener(MouseEvent.CLICK, contact);



function navbuttonclick(event:MouseEvent, myFrame:Number):void {
            gotoAndStop(myFrame);
}

Im having trouble getting my nav code working. I am not very proficient in actionscript, can anyone spot out what im doing wrong? Thanks in advance

//nav
var home:int = 1;
var about:int = 2;
var projects:int = 3;
var press_id:int = 4;
var contact:int = 5;

home_mc.addEventListener(MouseEvent.CLICK, home);
about_mc.addEventListener(MouseEvent.CLICK, about);
projects_mc.addEventListener(MouseEvent.CLICK,projects);
press_mc.addEventListener(MouseEvent.CLICK, press_id);
contact_mc.addEventListener(MouseEvent.CLICK, contact);



function navbuttonclick(event:MouseEvent, myFrame:Number):void {
            gotoAndStop(myFrame);
}

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

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

发布评论

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

评论(1

七分※倦醒 2024-12-30 02:36:08
//define frame indices
const HOME_FRAME:uint = 1;
const ABOUT_US_FRAME:uint = 2;

//set listeners
home_mc.addEventListener(MouseEvent.CLICK, home_mc_clickHandler);
home_mc.addEventListener(MouseEvent.CLICK, about_mc_clickHandler);

//define listeners
function home_mc_clickHandler(event:MouseEvent):void
{
    changePage(HOME_FRAME);
}

function about_mc_clickHandler(event:MouseEvent):void
{
    changePage(ABOUT_US_FRAME);
}

//change location
function changePage(frameIndex:uint):void
{
    gotoAndStop(frameIndex);
}
//define frame indices
const HOME_FRAME:uint = 1;
const ABOUT_US_FRAME:uint = 2;

//set listeners
home_mc.addEventListener(MouseEvent.CLICK, home_mc_clickHandler);
home_mc.addEventListener(MouseEvent.CLICK, about_mc_clickHandler);

//define listeners
function home_mc_clickHandler(event:MouseEvent):void
{
    changePage(HOME_FRAME);
}

function about_mc_clickHandler(event:MouseEvent):void
{
    changePage(ABOUT_US_FRAME);
}

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