Question: Is it possible to load an ActionScript 3 SWF and interact with it, for example by replacing some of its functions or editing variables? Similar to how it's possible in .NET using reflection and code generation.

I'm looking to add an extra layer of functionality over an existing 3rd-party AS3 app.

Answer: 
If you are loading it to another AS3 SWF, yes, you can access the public properties of the loaded SWF. You cannot replace functions - you can call functions, public ones, that is. 

```
var ldr:Loader = new Loader();
ldr.contentLoaderInfo.addEventListener(Event.COMPLETE, onLoad);
ldr.load(new URLRequest("filename.swf"));
private function onLoad(e:Event):void
{
    var swf:Object = LoaderInfo(e.target).content;
    swf.somePublicVar = newValue;
    swf.somePublicObject.publicMethod();
    swf.getChildAt(0).x = 30;
    //assuming there is a sprite at index 1
    var child:Sprite = Sprite(swf.getChildAt(1));
    child.graphics.lineStyle(1);
    child.graphics.drawCircle(10, 10, 10);
}

```

If you are loading 3rd party SWF from another domain (instead of copying it to your domain and loading it from there), the [following rule](http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/display/Loader.html) apply

* If the loaded content is a SWF file written with ActionScript 3.0, it cannot be cross-scripted by a SWF file in another security sandbox unless that cross-scripting arrangement was approved through a call to the [Security.allowDomain()](http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/system/Security.html#allowDomain()) or the `Security.allowInsecureDomain()` method in the loaded content file.

Which in short means that unless the SWF creator has explicitly allowed it to be modified from your domain, you cannot modify it by loading it remotely. This doesn't apply if you can get the SWF copied to your domain.
Well, you could could control the things(clips and other swf components) that are publicly available by digging in through the hierarchy of objects, just basic stuff. The other choice is you could decompile the loaded swf at runtime. This [library](http://code.google.com/p/as3swf/) sounds pretty interesting for that task.