--- /dev/null
+*.fla
+*.swf
\ No newline at end of file
--- /dev/null
+package {
+ import flash.utils.*;
+ import flash.display.MovieClip;
+
+ public class Overlay extends flash.display.MovieClip {
+
+ /*
+ * After doing some science, 50ms seems to be roughly the time it takes
+ * for a request to complete and for the locking to not happen.
+ */
+ private const REFRESH_RATE = 50;
+
+ public function Overlay() {
+ var streamInfo:StreamInfo = new StreamInfo();
+
+ setInterval(function() {
+ streamInfo.parse("Cam", function() {
+ test.text = streamInfo.getStreamParameter("a");
+ });
+ },this.REFRESH_RATE);
+ }
+
+ }
+
+}
--- /dev/null
+package {
+ import flash.events.Event;
+ import flash.net.*
+
+ public class StreamInfo {
+ private var request:URLRequest;
+ private var loader:URLLoader;
+ private var streamInfo = {};
+ private var fileLock = false;
+ private var callback:Function;
+
+ public function StreamInfo() {
+ this.request = new URLRequest("file:///Z:/Overlay/StreamInfo.txt");
+ this.loader = new URLLoader();
+ }
+
+ public function parse(section:String, callback:Function) {
+ if(!this.fileLock) {
+ this.callback = callback;
+ var loadCallback:Function = this.onLoaded(section, this);
+
+ loader.addEventListener(Event.COMPLETE, loadCallback);
+ this.fileLock = true;
+ this.loader.load(this.request);
+ loader.removeEventListener(Event.COMPLETE, callback);
+ } else {
+ trace("Lock active, not doing anything.");
+ }
+ }
+
+ public function getStreamParameter(name:String) {
+ return this.streamInfo[name];
+ }
+
+ private function releaseLock() {
+ this.fileLock = false;
+ }
+
+ private function onLoaded(section:String, streamInfo:StreamInfo):Function {
+ return function(e:Event):void {
+ //Deal with windows style line endings, and tabs.
+ var lines = streamInfo.loader.data.replace(/(\t|\r)/gi, "").split("\n");
+ var sectionLines:Array = streamInfo.extractSection(lines, section);
+ streamInfo.parseVars(sectionLines);
+ streamInfo.callback();
+ streamInfo.releaseLock();
+ }
+ }
+
+ private function extractSection(lines:Array, section:String) {
+ var sectionLines:Array = new Array();
+ var foundFirstLineOfSection:Boolean = false;
+ for each(var line in lines) {
+ foundFirstLineOfSection = !foundFirstLineOfSection ? line.indexOf("[" + section + "]") >= 0 : !line.match(/\[\w+\]/);
+
+ if(foundFirstLineOfSection) {
+ sectionLines.push(line);
+ }
+ }
+
+ return sectionLines;
+ }
+
+ private function parseVars(lines:Array) {
+ for each(var line in lines) {
+ var keyValue = line.split("=", 2);
+ if(keyValue.length == 2) {
+ this.streamInfo[keyValue[0]] = keyValue[1];
+ }
+ }
+ }
+ }
+}
--- /dev/null
+[Leeroy]
+Fang=It
+Yea=Boi
+
+[Cam]
+a=memesss
+c=d
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
+ <head>
+ <title>Overlay</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+ <style type="text/css" media="screen">
+ html, body { height:100%; background-color: #ffffff;}
+ body { margin:0; padding:0; overflow:hidden; }
+ #flashContent { width:100%; height:100%; }
+ </style>
+ </head>
+ <body>
+ <div id="flashContent">
+ <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="550" height="400" id="overlay" align="middle">
+ <param name="movie" value="overlay.swf" />
+ <param name="quality" value="high" />
+ <param name="bgcolor" value="#ffffff" />
+ <param name="play" value="true" />
+ <param name="loop" value="true" />
+ <param name="wmode" value="window" />
+ <param name="scale" value="showall" />
+ <param name="menu" value="true" />
+ <param name="devicefont" value="false" />
+ <param name="salign" value="" />
+ <param name="allowScriptAccess" value="sameDomain" />
+ <!--[if !IE]>-->
+ <object type="application/x-shockwave-flash" data="overlay.swf" width="550" height="400">
+ <param name="movie" value="overlay.swf" />
+ <param name="quality" value="high" />
+ <param name="bgcolor" value="#ffffff" />
+ <param name="play" value="true" />
+ <param name="loop" value="true" />
+ <param name="wmode" value="window" />
+ <param name="scale" value="showall" />
+ <param name="menu" value="true" />
+ <param name="devicefont" value="false" />
+ <param name="salign" value="" />
+ <param name="allowScriptAccess" value="sameDomain" />
+ <!--<![endif]-->
+ <a href="http://www.adobe.com/go/getflash">
+ <img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" />
+ </a>
+ <!--[if !IE]>-->
+ </object>
+ <!--<![endif]-->
+ </object>
+ </div>
+ </body>
+</html>