1 Reply Latest reply on May 5, 2007 12:01 PM by dr_ross

    How to make attachmovie call onLoad

    antonpav
      Hello,

      I'm trying to attach a movie but i need it to call onload function of this movie , i dont understant why its not working :

      here the code :
      import fm.controls.emoticonTextArea.*;
      private var m_text:FMemoticonTextArea; //0
      attachMovie("FMemoticonTextArea", "m_text", 0);
      m_text.onLoad = function(){
      trace("loading");
      m_text.keyWords.push({text:":baby", contentPath:"smi_babuy", scaleOn:"height"});
      }
      m_text.setSize(400,200);

      thanks
        • 1. Re: How to make attachmovie call onLoad
          dr_ross Level 1
          To be honest, i'm kind of mystified why you'd need an onload event to be triggered once attachMovie is complete, its instantaneous. Unless of course you're mistaken attachMovie for loadMovie, or you're using an exceptionally large movieclip from the library or shared library.

          Just having s second look you seem to be using a component which aside from being the devils work, can take a while to initialise before you can call methods on it like your

          "m_text.keyWords.push({text:":baby", contentPath:"smi_babuy", scaleOn:"height"});"

          put it into a function and have that called from a setInterval call a few hundred milliseconds later than the attachMovie code.

          Hopefully that should work for you.