# Rewrite flash native methods and classes

**URL:** <https://forum.kirupa.com/t/rewrite-flash-native-methods-and-classes/315242>\
**Category:** Uncategorized\
**Created:** [October 20, 2010, 9:54pm UTC](https://forum.kirupa.com/t/rewrite-flash-native-methods-and-classes/315242 "2010-10-20T21:54:47Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![sdc](https://avatars.discourse-cdn.com/v4/letter/s/779978/32.png) [@sdc](https://forum.kirupa.com/u/sdc)\
**Post date:** [October 20, 2010, 9:54pm UTC](https://forum.kirupa.com/t/rewrite-flash-native-methods-and-classes/315242/1 "2010-10-20T21:54:47Z")

</div>

Hey!

I’m new to the bbs, and I saw a few questions asking stuff similar to what I’m doing so I was hoping someone could help me :).

I am trying to do an app that requires me to change the behavior of a few native methods and classes of a an application.

I want to override methods such as:

ExternalInterface.call, ExternalInterface.addCallback, flash.net.navigateToURL in a loaded movie.

There are a few ways to do this for example:

1. Getting the SWF’s bytecode and decompile it. Then change the symbols table with my own class.

2. Loading the other movie in my applicationDomain, by doing so, I would be able to rewrite it’s own classes.

To do (2) what I did was:

1. Turn off the “-strict” flag.
2. Turn on the “-es” flag.

in the compiler and then do something like:

```auto
flash.net.navigateToURL = function(u:URLRequest,window:String):void {
  throw new Error("yay it works");
}
flash.net.navigateToURL(new URLRequest("http://www"), "1");

```

which throws no errors at compile time, but when I execute it, I receive:

```auto
ReferenceError: Error #1056: Cannot create property flash.net::navigateToURL on global.
	at Main/init()
	at Main()

```

Which I sense means that I can’t override anything under “flash”. Anybody knows how to do this?

Thanks for your time! 🙂
