2 Replies Latest reply on Apr 13, 2013 7:26 AM by Daniel12378992

    How to use classes with the Movie Clips

    Daniel12378992

      Hi guys!I have a movie clip called teacher.It's assigned to a class called teacher.It has a location(room).I have multiple rooms and so i want the teacher to be only visible in the room it's at.I have  two buttons for each room.The problem is the teacher doesn't disappear when it's in the playroom.

      package  {

       

                import flash.display.MovieClip;

                public class teacher extends MovieClip {

                          var room:String;

                          room="classroom";

                          this.croom=croom;

                          public function teacher() {

                                    var teacher:teacher=new teacher();

                          }

                          if(teacher.room!==croom){

                                    teacher.visible=false;

                          }

                          if (teacher.room==croom){

                                    teacher.visible=true;

                          }

                }

      }

        

      clroom.addEventListener(MouseEvent.CLICK, fl_MouseClickHandler);

       

       

      function fl_MouseClickHandler(event:MouseEvent):void

      {

       

                croom = "classroom";

                classroom.visible = true;

                playroom.visible = false;

       

       

      }

      btn.addEventListener(MouseEvent.CLICK, fl_MouseClickHandler_2);

       

       

      function fl_MouseClickHandler_2(event:MouseEvent):void

      {

                croom = "playroom";

                classroom.visible = false;

                playroom.visible = true;

       

       

      }