1 Reply Latest reply on Aug 6, 2009 5:37 AM by RossRitchey

    Passing name of video to be loaded from Document Class to another Class???

    keithwoods Level 1

      I've got a document class (EgoGame.as) and another class (Ball.as) which has been duplicated to deal with several different video pieces.


      Inside the document class is a list of 'if' statements which decide which video should be played.


      At the moment I'm doing it the old fashioned way whereby if the condition is true....it tells the relevant Ball class to gotoAndPlay a certain frame within the linked movieclip...


      e.g. '[0].gotoAndPlay("Blu");


      Is it possible to state within the document class which video to play by passing through an instruction to load a particular video? At the moment the video's play by a piece of code nested in the linked movie clip....


      e.g. flvControlBlu.source = "Resources/flvs/Blu1_Blu.flv";


      I'd like to get rid of the code in the movieclips and just create one piece of code in the Ball.as class which can then be duplicated when ever I need to add a new ball...rather than go through the hassle of putting a bit of code in the new movieclip every time.

        • 1. Re: Passing name of video to be loaded from Document Class to another Class???
          RossRitchey Level 4

          What you want to do is create a variable in the Ball class with a getter and a setter:


          private var _videoSource:String;


          public function get videoSource():String {

               return _videoSource;



          public function set videoSource(value:String):void {

               _videoSource = value as String;




          private function startVideo():void {

               flvControlBlu.source = _videoSource;




          then, in the document class, when you know the video to play:


          ball_object.videoSource = "video/to/play.flv";