# ARG! FMS and Webcam Record

**URL:** <https://forum.kirupa.com/t/arg-fms-and-webcam-record/239994>\
**Category:** flash\
**Created:** [September 28, 2007, 12:26am UTC](https://forum.kirupa.com/t/arg-fms-and-webcam-record/239994 "2007-09-28T00:26:07Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![dColumbus](https://avatars.discourse-cdn.com/v4/letter/d/edb3f5/32.png) [@dColumbus](https://forum.kirupa.com/u/dColumbus)\
**Post date:** [September 28, 2007, 12:26am UTC](https://forum.kirupa.com/t/arg-fms-and-webcam-record/239994/1 "2007-09-28T00:26:07Z")

</div>

Ok, I’m going to flip if I can’t find out what’s going on here…

I’m using Flex (I’m also developing in AS 3) and I need to be able to  
record some video from my webcam, store it on the FMS, and then be  
able to select is from a list and play it in another Flex app.

So far, I can’t even get the recording part down… I don’t know what’s  
wrong with my code…??

```auto

<?xml version="1.0"?> 
<!-- controls\videodisplay\VideoDisplayCamera.mxml --> 
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"> 

    <mx:Script> 
        <![CDATA[ 
     
             // Define a variable of type Camera. 
             import flash.media.Camera; 
             public var cam:Camera; 
             public var nc:NetConnection; 
             public var ns:NetStream; 

             public function initCamera():void { 
                // Initialize the variable. 
                cam = Camera.getCamera(); 
                myVid.attachCamera(cam); 
                
                nc.connect("rtmp://10.0.1.196:1935/videoApp"); 
                ns.attachCamera(cam); 
                
                ns.publish("testing", "live"); 
                
             } 
        ]]> 
    </mx:Script> 

    <mx:VideoDisplay id="myVid" width="320" height="240" 
creationComplete="initCamera();"/> 
</mx:Application

```

And I get the error:

TypeError: Error #1009: Cannot access a property or method of a null  
object reference.  
at VideoCreator/initCamera()  
at VideoCreator/\_\_myVid\_creationComplete()  
at flash.events::EventDispatcher/  
flash.events:EventDispatcher::dispatchEventFunction()  
at flash.events::EventDispatcher/dispatchEvent()  
at mx.core::UIComponent/dispatchEvent()  
at mx.core::UIComponent/set initialized()  
at mx.managers::LayoutManager/::doPhasedInstantiation()  
at Function/[http://adobe.com/AS3/2006/builtin::apply()](http://adobe.com/AS3/2006/builtin::apply())  
at mx.core::UIComponent/::callLaterDispatcher2()  
at mx.core::UIComponent/::callLaterDispatcher()

within my videoApp folder I have a main.asc file, but I’m not really sure  
what this is supposed to do and if there is a standard main.asc that I  
should be using…

Thank you in advance.
