0

我想问如何制作一个外部脚本.as 可以移动到时间轴上??我不了解as3 ..请帮助我:(

这是我要移至时间线的脚本

    package {
    import flash.display.*;
    import flash.events.*; 
    import flash.text.*;
    import flash.net.URLRequest;

    //import fl.display.ProLoader;

    dynamic public class bismillah extends MovieClip
    {
        public var ba:MovieClip;
        public var scorebox:TextField;
        public var alif:MovieClip;
        public var dal:MovieClip;
        public var tong:MovieClip;
        public var book:MovieClip;
        public var objArray:Array;
        public var targetArray:Array;
        public var objek:MovieClip;
        public var original_x:Number;
        public var original_y:Number;
        public var score:int;
        public var i:int;
        public var tombol1:MovieClip;
        var singleLoader:Loader = new Loader();

        public function bismillah()
        {
            stop();
            addFrameScript(0, frame1);
            tombol1 = Object(root).tombol1 as MovieClip;
            tombol1.addEventListener(MouseEvent.MOUSE_UP, tes);
            return;

        }// end function

        public function tes(param : MouseEvent) : void
        {
            var req:URLRequest = new URLRequest("dragdragon.swf");
            //singleLoader.unload();
            singleLoader.load(req);
            addChild(singleLoader);

        }

        public function down(param1:MouseEvent) : void
        {
            objek = MovieClip(param1.target);
            original_x = objek.x;
            original_y = objek.y;
            addChild(objek);
            objek.startDrag();
            stage.addEventListener(MouseEvent.MOUSE_UP, stageUp);
            return;
        }// end function

        public function stageUp(param1:MouseEvent) : void
        {
            stage.removeEventListener(MouseEvent.MOUSE_UP, stageUp);
            objek.stopDrag();
            if (objek.dropTarget)
            {
                if (objek.dropTarget.parent.name == "book")
                {
                if ((objek == alif) || (objek == ba)){  //yg perlu diganti
                    objek.x = objek.dropTarget.parent.x;
                    objek.y = objek.dropTarget.parent.y + 50;
                    objek.removeEventListener(MouseEvent.MOUSE_DOWN, down);
                    objek.buttonMode = false;
                    var _loc_2:Number;
                    objek.scaleY = 0.4;
                    objek.scaleX = _loc_2;
                    objek.alpha = 0.6;
                    score+=5;
                    scorebox.text = "Score: " + score;
                }
                else {
                objek.x = objek.dropTarget.parent.x;
                    objek.y = objek.dropTarget.parent.y + 50;
                    objek.removeEventListener(MouseEvent.MOUSE_DOWN, down);
                    objek.buttonMode = false;
                    var _loc_2:Number;
                    objek.scaleY = 0.4;
                    objek.scaleX = _loc_2;
                    objek.alpha = 0.6;
                    score-=2;
                    scorebox.text = "Score: " + score;}
                }

                else if (objek.dropTarget.parent.name == "tong")
                {
                    if (objek == dal) { //yg perlu diganti
                    objek.x = objek.dropTarget.parent.x;
                    objek.y = objek.dropTarget.parent.y + 50;
                    objek.removeEventListener(MouseEvent.MOUSE_DOWN, down);
                    objek.buttonMode = false;
                    var _loc_2:Number;
                    objek.scaleY = 0.4;
                    objek.scaleX = _loc_2;
                    objek.alpha = 0.6;
                    score+=5;
                    scorebox.text = "Score: " + score;
                }
                else {
                    objek.x = objek.dropTarget.parent.x;
                    objek.y = objek.dropTarget.parent.y + 50;
                    objek.removeEventListener(MouseEvent.MOUSE_DOWN, down);
                    objek.buttonMode = false;
                    var _loc_2:Number;
                    objek.scaleY = 0.4;
                    objek.scaleX = _loc_2;
                    objek.alpha = 0.6;
                    score-=2;
                    scorebox.text = "Score: " + score;
                    }
                }
            }
            else
            {
                objek.x = original_x;
                objek.y = original_y;
            }
            return;
        }// end function

        public function returnToOriginalPosition() : void
        {
            return;
        }// end function

        function frame1()
        {
            objArray = [alif, dal, ba]; //yg perlu diganti
            targetArray = [book, tong];
            score = 0;
            scorebox.text = "Score: " + score;
            i = 0;
            while (i < objArray.length)
            {

                objArray[i].buttonMode = true;
                objArray[i].addEventListener(MouseEvent.MOUSE_DOWN, down);
                i++;
            }
            return;
        }// end function


    }

}

请问有人可以帮我把代码移到时间线上吗?

4

1 回答 1

0
  1. 在 fla 库中创建新的 MovieClip
  2. 选择“为 ActionScript 导出”复选框
  3. 在输入字段“Class”中输入您的 as 文件的名称
  4. 将 *.as 文件放在与 fla 文件相同的文件夹中。

不要忘记在新的 MovieClip - bascorebox等中创建所有嵌套剪辑。

于 2013-01-25T12:39:51.320 回答