5 Replies Latest reply on May 12, 2006 3:32 PM by pwyon

    Flash 8: Making a component.

    pwyon Level 1
      It's really odd. When I test my scene (press ctrl+enter) and then go back to the "component inspector" the second I change a field and press "backspace" to delete a number in a textfield, it RESETS!! It's driving me crazy. Is this a bug in Flash8 or a bug in my code?
        • 1. Re: Flash 8: Making a component.
          pwyon Level 1
          ..actually, ive tested it some more. it resets even if i use a slider, change a field--anything i do makes it reset!! has anyone experienced this before? i never had this problem in MX2004.

          it has to be something simple.
          • 2. Re: Flash 8: Making a component.
            pwyon Level 1
            It was something simple.
            • 3. Re: Flash 8: Making a component.
              Level 7

              "pwyon" <webforumsuser@macromedia.com> wrote in message
              > It was something simple.

              Anytime you solve your own problem it is nice to post your solution.

              Imagine someone else searching for the same problem you were having
              only to find this thread and then having it end with...
              "It was something simple"

              Post your simple answer.


              • 4. Re: Flash 8: Making a component.
                abeall Level 3
                Maybe it was embarrassing
                • 5. Re: Flash 8: Making a component.
                  pwyon Level 1
                  Well, it wasn't simple to do because I had som many variables. But it was a simple solution. Sorry for not leaving a longer reply, but it was very late in the evening when I figured it out.

                  1.) My code was just sloppy. I didn't use get/set on any of the variables I declared in my Class. Like this:

                  //The better way...
                  [Inspectable (type="Number" , defaultValue="myParticle" )]
                  public function set $particleName($particleName:String){
                  particleName = $particleName;
                  }//end set
                  public function get $particleName(){
                  return particleName;
                  }//end get

                  //the way I had it...
                  [Inspectable (type="Number" , defaultValue="myParticle" )]
                  var public particleName:String;

                  2.) The sliders I made were reseting but the textfields were ok with my code like this in the Component_UI:

                  //textfiled something like this
                  this.onLoad = function(){
                  ParticleID.text = xch.$particleName;
                  }//end onLoad

                  //slider I made something like this
                  RateSlider.onMouseUp = function(){
                  sx = this.sliderButton._x;
                  Rate.text = sx;
                  xch.$genRate = sx;
                  }//end function

                  The problem was, when I reselected the component on the stage, it would reset. Actually just about anything I did would reset the darn things. So I decided to see if setting thier current position to value of the xch.$variable onLoad would do the job. Like this:

                  this.onLoad = function(){
                  Rate.text = xch.$genRate;
                  RateSlider.sliderButton._x = xch.$genRate;
                  }//end onLoad

                  Yup, that worked. So I did the same for the rest of all my sliders in my Component_UI and things seem to be running smoothly now.

                  Does that make sense. Someone else might be able to see what I did and explain it better.

                  Take care! I hope that helps someone.