views:

38

answers:

0

Maybe some of you guys know bout vCam from http://bryanheisey.com/blog/?page_id=22 I'm trying to have the script running on a custom classes instead of a MovieClip in the library. But after some trying I fail so I stick back to having the MC in the library and load the MC from the project root action-script files.

Now it works fine if I run the MC on the root as files, but for more organizing purposes on my action-script files, I was thinking of calling it from a custom classes(where I can control the vCam), then call the custom classes from the root action-script files. But seems like it won't work other than the root action-script files.

I'm not sure whether I'm missing any codes between the two custom classes, or its not coded to run that way. If it's not, then its fine too just that I want the things more organize. Or if you have any idea how to 'by-pass' this, please do tell me so.

In case you need my code for the 2 classes, here it is:

package {
 import flash.display.MovieClip;

 import classes.vCamera;

 public class main extends MovieClip {

  private var vC2:vCamera = new vCamera();

  public function main():void {

   addChild(vC2)
  }
 }
}

package classes{


import flash.display.MovieClip;
 import flash.display.Stage;
 import flash.events.Event;

 public class vCamera extends MovieClip{  

  private var vC:vCam = new vCam();

  public function vCamera():void{   
  addEventListener(Event.ADDED_TO_STAGE, add2Stage)
  }

  private function add2Stage(event:Event):void{
   vC.x=stage.stageWidth/2;
   vC.y=stage.stageHeight/2;
   vC.rotation=15;
   addChild(vC);
  }
 }
}