0 Replies Latest reply: Jul 24, 2012 9:04 PM by streamworksaudio RSS

    Using a function to change Netstream video size.

    streamworksaudio

      Hi folks,

       

      forgive me I am new to script in Flex.  I got an Application that has two scripted functions.  The first is called at creationComplete and sets up a netconnect/netstream video playback.  And a second that is fired when a button is clicked, which sets the application to Full Screen.  What I want to do is resize the video at the same time.  For testing purpose I am using hard coded values that match my monitor size.

       

      The problem I am having is that the code I wrote to change the video size spits out an error "1120: Access of undefined property vid."  - Is it possible to have one function access the vairibles of another function?

       

      My code:

       

      <mx:Script>
              <![CDATA[
                  private function initApp():void
                  {
                      var nc:NetConnection = new NetConnection(); 
                      nc.connect(null);
                      
                      var ns:NetStream = new NetStream(nc); 
                      ns.addEventListener(AsyncErrorEvent.ASYNC_ERROR, asyncErrorHandler);  
                      ns.addEventListener(DRMAuthenticateEvent.DRM_AUTHENTICATE, DRMAuthHandler);
                      ns.play("gm.f4v"); 
                      function asyncErrorHandler(event:AsyncErrorEvent):void 
                      { 
                          // ignore error 
                      }
                      
                      var vid:Video = new Video(); 
                      vid.attachNetStream(ns); 
                      vidUI.addChild(vid);
                      
                      vid.width=851;
                      vid.height=480;
                      
                      function DRMAuthHandler(event:DRMAuthenticateEvent):void
                      {
                          ns.setDRMAuthenticationCredentials("test","test","drm");
                      }
                  }
                  
                  public function goFull():void
                  {
                      stage.displayState = StageDisplayState.FULL_SCREEN_INTERACTIVE;
                      vid.width=1920;
                      vid.height=1080;
                  }
              ]]>
          </mx:Script>
      

       

      I want the function goFull to change the video size that is loaded from the initApp function.... possible?

       

      Cheers!

      Chris