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…??
<?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()
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.