# Using Proxy

**URL:** <https://forum.kirupa.com/t/using-proxy/276480>\
**Category:** flash\
**Created:** [November 28, 2008, 9:21am UTC](https://forum.kirupa.com/t/using-proxy/276480 "2008-11-28T09:21:52Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ice13](https://avatars.discourse-cdn.com/v4/letter/i/dec6dc/32.png) [@ice13](https://forum.kirupa.com/u/ice13)\
**Post date:** [November 28, 2008, 9:21am UTC](https://forum.kirupa.com/t/using-proxy/276480/1 "2008-11-28T09:21:52Z")

</div>

Hi,

I’m not sure if this is possible but I’ve been trying to come up with something which uses flash\_proxy override getProperty to run some code on a variable call, but to also make use of code-hinting in flash editors (FlashDevelop). So if I’ve got this class

```auto
package {

	import flash.utils.describeType;
	import flash.utils.Proxy;
	import flash.utils.flash_proxy;
	
	public dynamic class LangStrings extends Proxy {

		public var myVariable:String = "Test <test>";
		public var myVariable2:String = "Test 2";
		
		private function findAndReplace($str:String):String {
			$str = $str.split("<test>").join("rep");
			return $str;
		}
		
		private var dataObj:Object = { };
		public function LangStrings() {
			dataObj = {};
			var varList:XMLList = describeType(this)..variable;
			var tempList:Array = [];
			for(var i:int; i < varList.length(); i++){
				tempList.push({name:varList*.@name, content:this[varList*.@name]});
			}
			tempList.sortOn("name");
			for (var j:int = 0; j < tempList.length; j++) {
				dataObj[tempList[j].name] = tempList[j].content;
			}
		}

		override flash_proxy function getProperty(name:*):* {
			var checkStr:String = dataObj[name];
			if (checkStr == null) {
				trace("Error - variable not found - id:" + name);
				return "!" + name;
			}else {
				checkStr = findAndReplace(checkStr);
				return checkStr;
			}
		}
	}
}

```

and then I go

```auto
var testProxy:LangStrings = new LangStrings();
trace("test var:" + testProxy.myVariable);

```

This allows code-hinting to work but because it’s a predeclared variable the ‘override flash\_proxy function getProperty’ doesn’t trigger and therefore won’t run the findAndReplace function. Any ideas?

Thanks  
Richard
