# The simplest example, I cant get it to work in flex.

**URL:** <https://community.wowza.com/t/the-simplest-example-i-cant-get-it-to-work-in-flex/39630>\
**Category:** Wowza Streaming Engine\
**Created:** [March 17, 2013, 3:42pm UTC](https://community.wowza.com/t/the-simplest-example-i-cant-get-it-to-work-in-flex/39630 "2013-03-17T15:42:47Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Phil\_jackson](https://avatars.discourse-cdn.com/v4/letter/p/e274bd/32.png) [@Phil\_jackson](https://community.wowza.com/u/Phil_jackson)\
**Post date:** [March 17, 2013, 3:42pm UTC](https://community.wowza.com/t/the-simplest-example-i-cant-get-it-to-work-in-flex/39630/1 "2013-03-17T15:42:47Z")

</div>

Hi,

Im just starting out and Im feeling really dumb because I’m having trouble getting really simple examples to work.

Im trying to make a flex version of the simple video stream that opens when wowza starts. Im using the code from page 46 of the user guide.

There are lots of examples, and they look great, but they are all .fla files which I cant open in flash builder.

Here is my mxml file that Im using at the moment, which is the best I have been able to do, I am getting sound out of this but video is black.

Any help would be really appreciated, I think I just need something really simple that I can play around with to get started.

```auto
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
			   xmlns:s="library://ns.adobe.com/flex/spark" 
			   xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600"
			   initialize="init()">
	<fx:Declarations>
		<!-- Place non-visual elements (e.g., services, value objects) here -->
	</fx:Declarations>
	
	<fx:Script>
		<![CDATA[
			
			private var myCam:Camera;
			//private var camVideo:Video;
			private var wowzaVideo:Video;
			private var nc:NetConnection = new NetConnection();
			private var ns:NetStream = null;
			private function init():void
			{
				nc.addEventListener(NetStatusEvent.NET_STATUS, ncOnStatus);
				nc.connect("rtmp://localhost/vod");
				
				myCam = Camera.getCamera();
				camVideoDisplay.attachCamera(myCam);
			}
			private function ncOnStatus(infoObject:NetStatusEvent):void
			{
				if (infoObject.info.code == "NetConnection.Connect.Success")
				{
					ns = new NetStream(nc);
					
					ns.bufferTime = 3;
					
					//wowzaVideo.attachNetStream(ns);
					//wowzaVideoDisplay.addChild(wowzaVideo);
					
					ns.play("mp4:sample.mp4")
						
					wowzaVideo.attachNetStream(ns);
					wowzaVideoDisplay.addChild(wowzaVideo);
				}
				
			}
			
			
		]]>
	</fx:Script>
	
	<mx:VideoDisplay id="wowzaVideoDisplay" x="404" y="48" width="282" height="222"/>
	<mx:VideoDisplay id="camVideoDisplay" x="74" y="48" width="282" height="222"/>
	
</s:Application>

```

---

<div class="post-metadata">

**Author:** ![Jay\_Charles](https://avatars.discourse-cdn.com/v4/letter/j/c89c15/32.png) [@Jay\_Charles](https://community.wowza.com/u/Jay_Charles)\
**Post date:** [March 18, 2013, 7:50am UTC](https://community.wowza.com/t/the-simplest-example-i-cant-get-it-to-work-in-flex/39630/2 "2013-03-18T07:50:00Z")

</div>

You can’t add a video object as a child of a VideoDisplay in flex. You can add the video object to a UIComponent, or you can attach the netstream to the VideoDisplay’s mx\_internal::videoPlayer. See [http://stackoverflow.com/questions/42333/how-to-display-a-live-streaming-video-using-videodisplay-in-flex](http://stackoverflow.com/questions/42333/how-to-display-a-live-streaming-video-using-videodisplay-in-flex) for details.

---

<div class="post-metadata">

**Author:** ![Richard\_Lanham](https://avatars.discourse-cdn.com/v4/letter/r/c68b51/32.png) [@Richard\_Lanham](https://community.wowza.com/u/Richard_Lanham)\
**Post date:** [March 18, 2013, 1:24pm UTC](https://community.wowza.com/t/the-simplest-example-i-cant-get-it-to-work-in-flex/39630/3 "2013-03-18T13:24:51Z")

</div>

You can use this for reference:

[http://wowza.com/downloads/examples/flex/SimpleVideoStreaming.zip](http://wowza.com/downloads/examples/flex/SimpleVideoStreaming.zip)

Richard

---

<div class="post-metadata">

**Author:** ![Richard\_Lanham](https://avatars.discourse-cdn.com/v4/letter/r/c68b51/32.png) [@Richard\_Lanham](https://community.wowza.com/u/Richard_Lanham)\
**Post date:** [April 29, 2013, 3:38pm UTC](https://community.wowza.com/t/the-simplest-example-i-cant-get-it-to-work-in-flex/39630/4 "2013-04-29T15:38:23Z")

</div>

You need direct link for each example. These are all of them:

[http://wowza.com/downloads/examples/flex/LiveVideoStreaming.zip](http://wowza.com/downloads/examples/flex/LiveVideoStreaming.zip)

[http://wowza.com/downloads/examples/flex/SimpleVideoStreaming.zip](http://wowza.com/downloads/examples/flex/SimpleVideoStreaming.zip)

[http://wowza.com/downloads/examples/flex/VideoChat.zip](http://wowza.com/downloads/examples/flex/VideoChat.zip)

[http://wowza.com/downloads/examples/flex/VideoRecording.zip](http://wowza.com/downloads/examples/flex/VideoRecording.zip)

Richard

---

<div class="post-metadata">

**Author:** ![Anthony\_Guglielmo](https://avatars.discourse-cdn.com/v4/letter/a/ce7236/32.png) [@Anthony\_Guglielmo](https://community.wowza.com/u/Anthony_Guglielmo)\
**Post date:** [April 29, 2013, 10:28am UTC](https://community.wowza.com/t/the-simplest-example-i-cant-get-it-to-work-in-flex/39630/5 "2013-04-29T10:28:21Z")

</div>

> Thankyou both!
> 
> thats all I was really after I can get it to work now.

I tried to navigate to the root directory of flex examples for [http://wowza.com/downloads/examples/flex/SimpleVideoStreaming.zip](http://wowza.com/downloads/examples/flex/SimpleVideoStreaming.zip) at [http://wowza.com/downloads/examples/flex/](http://wowza.com/downloads/examples/flex/) and I get a 404 type error. Is there a new link for them?

---

<div class="post-metadata">

**Author:** ![Phil\_jackson](https://avatars.discourse-cdn.com/v4/letter/p/e274bd/32.png) [@Phil\_jackson](https://community.wowza.com/u/Phil_jackson)\
**Post date:** [March 19, 2013, 8:49pm UTC](https://community.wowza.com/t/the-simplest-example-i-cant-get-it-to-work-in-flex/39630/6 "2013-03-19T20:49:15Z")

</div>

Thankyou both!

thats all I was really after I can get it to work now.
