使用按钮加载电影

时间:2013-08-13 12:37:34

标签: actionscript-3 flash

我正在尝试通过与ActionScript 3.0的按钮交互来加载电影。我正在从Flash CS 5.5创建这部电影。

我可以得到第一个按钮(我称之为“Preface”)。添加第二个按钮时,我在运行时收到此错误:

Scene 1, Layer 'Actions', Frame 1, Line 22  1023: Incompatible override.
Scene 1, Layer 'Actions', Frame 1, Line 22  1021: Duplicate function definition.

似乎有任何重复,可以启动任何覆盖:

//import flash.events.MouseEvent;

preface.addEventListener(MouseEvent.CLICK, preface1);
sq.addEventListener(MouseEvent.CLICK, sq);

function preface1(event:MouseEvent):void
{
    // Start your custom code
    // This example code displays the words "Mouse clicked" in the Output panel.
    trace("Mouse clicked");

    var preface:Preface= new Preface;
    addChild(preface);
    preface.removeEventListener(MouseEvent.CLICK, preface1);

    // End your custom code
}

function sq(event:MouseEvent):void
{
    //Get sample menus
}

非常感谢任何指示。

1 个答案:

答案 0 :(得分:2)

您有一个名为sq的MovieClip实例,并声明了一个名为sq的函数。这不再适用于Actionscript 3.您必须将您的函数命名为sqpreface以外的函数,因为此名称已被您的另一个MC占用。