• 上机第十二讲——Flash第九课时

    普通类
    • 支持
    • 批判
    • 提问
    • 解释
    • 补充
    • 删除
    • 本讲微视频下载:

    本讲微视频操作下载:Flash第九次视频——连线题.rar

    同学们也可以从右侧学习资源栏目中,选择需要的视频下载。

    • 请参加下面的练习和问卷调查

    经过一个学期的学习,和大家一起度过了很多快乐的时光。

    在结束之际,希望大家参加下面的问卷调查,多谢大家了!

    http://www.sojump.com/jq/1608795.aspx

    • 分享你的作品吧

    视频课程下载在每个视频课程的下面。

    上次课上多位同学发布了自己的作品,且很多同学主动下载浏览其他人的作品,非常的好,这次照例请大家上传自己课上作品(为方便查看,不用发布在社区,发布在每次作业的学习元的作品分布区)。

    注意:提交fla文件,命名为“学号 姓名 作品名称”

    连线题作品分享

    • 本课微视频及源代码

    连线题1

    连线题2

    连线题3

    本课案例源代码

    var line1:Sprite = new Sprite();

    //line1.graphics.beginFill(0xFFFFFF);

    //line1.graphics.drawRect(0, 0, 500, 400);

    //line1.graphics.endFill();

    addChildAt(line1, 0);

    line1.graphics.lineStyle(3, 0x0000FF);

    var left1Answer:int = 0;

    var left2Answer:int = 0;

    var left3Answer:int = 0;

    var left4Answer:int = 0;

    var selectItem:int = 0;

    left1.addEventListener(MouseEvent.CLICK, function(){

      line1.graphics.moveTo(left1.x, left1.y);

      selectItem = 1;

    });

    left2.addEventListener(MouseEvent.CLICK, function(){

      line1.graphics.moveTo(left2.x, left2.y);

      selectItem = 2;

    });

    left3.addEventListener(MouseEvent.CLICK, function(){

      line1.graphics.moveTo(left3.x, left3.y);

      selectItem = 3;

    });

    left4.addEventListener(MouseEvent.CLICK, function(){

      line1.graphics.moveTo(left4.x, left4.y);

      selectItem = 4;

    });

    right1.addEventListener(MouseEvent.CLICK, function(){

      line1.graphics.lineTo(right1.x, right1.y);

      if(selectItem == 1) {

        left1Answer = 1;

      } else if(selectItem == 2) {

        left2Answer = 1;

      } else if(selectItem == 3) {

        left3Answer = 1;

      } else if(selectItem == 4) {

        left4Answer = 1;

      }

    });

    right2.addEventListener(MouseEvent.CLICK, function(){

      line1.graphics.lineTo(right2.x, right2.y);

      if(selectItem == 1) {

        left1Answer = 2;

      } else if(selectItem == 2) {

        left2Answer = 2;

      } else if(selectItem == 3) {

        left3Answer = 2;

      } else if(selectItem == 4) {

        left4Answer = 2;

      }

    });

    right3.addEventListener(MouseEvent.CLICK, function(){

      line1.graphics.lineTo(right3.x, right3.y);

      if(selectItem == 1) {

        left1Answer = 3;

      } else if(selectItem == 2) {

        left2Answer = 3;

      } else if(selectItem == 3) {

        left3Answer = 3;

      } else if(selectItem == 4) {

        left4Answer = 3;

      }

    });

    right4.addEventListener(MouseEvent.CLICK, function(){

      line1.graphics.lineTo(right4.x, right4.y);

      if(selectItem == 1) {

        left1Answer = 4;

      } else if(selectItem == 2) {

        left2Answer = 4;

      } else if(selectItem == 3) {

        left3Answer = 4;

      } else if(selectItem == 4) {

        left4Answer = 4;

      }

    });

    课堂上的源代码(不完整)

    var line1:Sprite = new Sprite();
    var line2:Sprite = new Sprite();
    var line3:Sprite = new Sprite();
    var line4:Sprite = new Sprite();
    addChildAt(line1, 0);
    addChildAt(line2, 0);
    addChildAt(line3, 0);
    addChildAt(line4, 0);

    var selectItem:int = 0;

    var left1Answer:Array = [];
    var left2Answer:int = 0;
    var left3Answer:int = 0;
    var left4Answer:int = 0;

    left1Answer[0] = 1;
    left1Answer[1] = 2;
    left1Answer[left1Answer.length] = 3;

    line1.graphics.lineStyle(3, 0xFF0000);
    line2.graphics.lineStyle(3, 0xFF0000);
    line3.graphics.lineStyle(3, 0xFF0000);
    line4.graphics.lineStyle(3, 0xFF0000);

    left1.addEventListener(MouseEvent.CLICK,
     function () {
      left1.gotoAndStop(2);
      selectItem = 1;
      line1.graphics.moveTo(left1.x, left1.y);
     });
    left2.addEventListener(MouseEvent.CLICK,
     function () {
      left2.gotoAndStop(2);
      selectItem = 2;
      line2.graphics.moveTo(left2.x, left2.y);
     });
    left3.addEventListener(MouseEvent.CLICK,
     function () {
      left3.gotoAndStop(2);
      selectItem = 3;
      line3.graphics.moveTo(left3.x, left3.y);
     });
    left4.addEventListener(MouseEvent.CLICK,
     function () {
      left4.gotoAndStop(2);
      selectItem = 4;
      line4.graphics.moveTo(left4.x, left4.y);
     });
    right1.addEventListener(MouseEvent.CLICK,
     function () {
      if(selectItem == 1) {
       left1.gotoAndStop(1);
       if(left1Answer != 0) {
        line1.graphics.clear();
        line1.graphics.lineStyle(3, 0xFF0000);
        line1.graphics.moveTo(left1.x, left1.y);
       }
       line1.graphics.lineTo(right1.x, right1.y);
       left1Answer = 1;
      } else if(selectItem == 2) {
       left2.gotoAndStop(1);
       if(left2Answer != 0) {
        line2.graphics.clear();
        line2.graphics.lineStyle(3, 0xFF0000);
        line2.graphics.moveTo(left2.x, left2.y);
       }
       left2Answer = 1;
       line2.graphics.lineTo(right1.x, right1.y);
      } else if(selectItem == 3) {
       left3.gotoAndStop(1);
       if(left3Answer != 0) {
        line3.graphics.clear();
        line3.graphics.lineStyle(3, 0xFF0000);
        line3.graphics.moveTo(left3.x, left3.y);
       }
       left3Answer = 1;
       line3.graphics.lineTo(right1.x, right1.y);
      } else if(selectItem == 4) {
       left4.gotoAndStop(1);
       if(left4Answer != 0) {
        line4.graphics.clear();
        line4.graphics.lineStyle(3, 0xFF0000);
        line4.graphics.moveTo(left4.x, left4.y);
       }
       left4Answer = 1;
       line4.graphics.lineTo(right1.x, right1.y);
      }
      selectItem = 0;
     });
    right2.addEventListener(MouseEvent.CLICK,
     function () {
      if(selectItem == 1) {
       left1.gotoAndStop(1);
       left1Answer = 2;
       line1.graphics.lineTo(right2.x, right2.y);
      } else if(selectItem == 2) {
       left2.gotoAndStop(1);
       left2Answer = 2;
       line2.graphics.lineTo(right2.x, right2.y);
      } else if(selectItem == 3) {
       left3.gotoAndStop(1);
       left3Answer = 2;
       line3.graphics.lineTo(right2.x, right2.y);
      } else if(selectItem == 4) {
       left4.gotoAndStop(1);
       left4Answer = 2;
       line4.graphics.lineTo(right2.x, right2.y);
      }
      selectItem = 0;
     });
    right3.addEventListener(MouseEvent.CLICK,
     function () {
      if(selectItem == 1) {
       left1.gotoAndStop(1);
       left1Answer = 3;
       line1.graphics.lineTo(right3.x, right3.y);
      } else if(selectItem == 2) {
       left2.gotoAndStop(1);
       left2Answer = 3;
       line2.graphics.lineTo(right3.x, right3.y);
      } else if(selectItem == 3) {
       left3.gotoAndStop(1);
       left3Answer = 3;
       line3.graphics.lineTo(right3.x, right3.y);
      } else if(selectItem == 4) {
       left4.gotoAndStop(1);
       left4Answer = 3;
       line4.graphics.lineTo(right3.x, right3.y);
      }
      selectItem = 0;
     });
    right4.addEventListener(MouseEvent.CLICK,
     function () {
      if(selectItem == 1) {
       left1.gotoAndStop(1);
       left1Answer = 4;
       line1.graphics.lineTo(right4.x, right4.y);
      } else if(selectItem == 2) {
       left2.gotoAndStop(1);
       left2Answer = 4;
       line2.graphics.lineTo(right4.x, right4.y);
      } else if(selectItem == 3) {
       left3.gotoAndStop(1);
       left3Answer = 4;
       line3.graphics.lineTo(right4.x, right4.y);
      } else if(selectItem == 4) {
       left4.gotoAndStop(1);
       left4Answer = 4;
       line4.graphics.lineTo(right4.x, right4.y);
      }
      selectItem = 0;
     });

    • 微视频相关Flash源文件下载:
    • 学完微视频,请流下学习感受(希望能反馈具体建议)
    • 标签:
    • 连线
    • mouseevent.click
    • left1answer
    • var
    • function
    • sprite
    • selectitem
    • 视频
    • left2answer
    • 作品
  • 加入的知识群:
    学习元评论 (0条)

    评论为空
    聪明如你,不妨在这 发表你的看法与心得 ~



    登录之后可以发表学习元评论
      
暂无内容~~
顶部