# Classes may only be defined in external ActionScript 2.0 class scripts

**URL:** <https://forum.kirupa.com/t/classes-may-only-be-defined-in-external-actionscript-2-0-class-scripts/194277>\
**Category:** Uncategorized\
**Created:** [July 21, 2006, 8:01pm UTC](https://forum.kirupa.com/t/classes-may-only-be-defined-in-external-actionscript-2-0-class-scripts/194277 "2006-07-21T20:01:49Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![garebear](https://avatars.discourse-cdn.com/v4/letter/g/b782af/32.png) [@garebear](https://forum.kirupa.com/u/garebear)\
**Post date:** [July 21, 2006, 8:01pm UTC](https://forum.kirupa.com/t/classes-may-only-be-defined-in-external-actionscript-2-0-class-scripts/194277/1 "2006-07-21T20:01:49Z")

</div>

I am trying to integrate flash and coldfusion. I have been following a tutorial in “Macromedia Coldfusion MX 7” that has given me a good start. However, every time I try to publish the flash file, I come up with the error “Classes may only be defined in external ActionScript 2.0 class scripts.” I googled it up and found what others have found to be the problem… ([http://www.adobe.com/devnet/flash/articles/migrate\_flashmx2004\_02.html) that [URL=“http://www.adobe.com/devnet/flash/articles/migrate\_flashmx2004\_02.html”]**[COLOR=#000000]The name of an AS class file must match the name of the class it contains[/COLOR]**](http://www.adobe.com/devnet/flash/articles/migrate_flashmx2004_02.html). Well, I think it does…

Inside the NetServices.as file that it is referencing, the line of code that flash has a problem with is: “class mx.remoting.NetServices extends Object”

Inside the flash file…

**#include “…/…/…/…/coldfusion/NetServices.as”** //this is where I have put the file

// Application initialization  
**if (inited == null) {**  
**inited = true;** // to do this only once  
**NetServices.setDefaultGatewayUrl("**\<A href=“[http://localhost:8500/flashservices/gateway](http://localhost:8500/flashservices/gateway)”) //"\>\*\*[http://localhost:8500/flashservices/gateway](http://localhost:8500/flashservices/gateway)") \*\*// set the default gateway URL  
**gateway\_conn = NetServices.createGatewayConnection();** // connect to the gateway  
**myService = gateway\_conn.getService(“coldfusion”, this);** // get a reference to a service // In this case, the “service” is the /ows/23 directory in web server root  
}

Anyways, in both cases, I am using “NetServices” so I don’t see what the problem could be.

Any help with this would be greatly appreciated and if you need more clarification on what I am trying to accomplish, please feel free to ask.

Thanks again!
