4 Replies Latest reply on Sep 17, 2007 5:55 PM by RaGlitter

    class functions accessable from the timeline of a loaded .swf

    RaGlitter Level 1
      I'm new to using classes in flash. Here is what i'm trying to do. I load a .swf file (lets call it child) into a movieclip within another .swf file (lets call it parent). I then try to assign a class to child. Then I try to call a function in childs class from childs timeline.

      Currently the function isnt working, isnt being called correctly, or something.

      Let me run through my steps in a little more detail (with some abreviation):

      #1 Load a movie into an empty movieclip in parent:

      containerClips = this.createEmptyMovieClip("childmovie"+i,(10+i));
      loaders[ni-1].loadClip("sections/"+contentMovieNamesQueue[ni-1], containerClips[ni-1]);

      #2 assign the child a class:

      function loadingCompleted(target_mc:MovieClip) {
      trace("this does happen, the child is loaded and does display");
      subMovies[queueOrder[0]] = new subMovie04(target_mc);
      }

      #3 in the class subMovie04.as

      public function subMovie04(passed_mc:MovieClip){
      thisSubMovie = passed_mc;
      trace("this._name = "+this._name+" or thisSubMovie = "+thisSubMovie+" starting!"); // this._name is undefined but thisSubMovie traces successfully
      }
      public function firstFrame(){
      trace("thisSubMovie = "+thisSubMovie+" firstFrame() called"); // this trace never gets called
      }

      #4 in the first frame of child

      firstFrame();

      So I expect I'm missing something obvious, or even trying to do something I can't (I hope thats not it). I do have some more function calls after the first frame, so its not that it hasnt been assigned the class when the first frame is played.

      What I want is for the code in child to perform functions defined in parent, that act on variables contained within child. Ideally I'd like to do it while learning more OO programming.

      Thanks for taking the time to read my problem and I'd really apreciate some help
      Jon