# How to access classes from embedded SWF

**URL:** <https://forum.kirupa.com/t/how-to-access-classes-from-embedded-swf/322439>\
**Category:** flash\
**Created:** [May 20, 2011, 5:54pm UTC](https://forum.kirupa.com/t/how-to-access-classes-from-embedded-swf/322439 "2011-05-20T17:54:36Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![rumblesushi](https://avatars.discourse-cdn.com/v4/letter/r/b38774/32.png) [@rumblesushi](https://forum.kirupa.com/u/rumblesushi)\
**Post date:** [May 20, 2011, 5:54pm UTC](https://forum.kirupa.com/t/how-to-access-classes-from-embedded-swf/322439/1 "2011-05-20T17:54:36Z")

</div>

Have any of you guys attempted to embed a library SWF and access the classes as it was an externally loaded SWF? If so, how is it done?

In an effort to make my game into a single SWF, I have no other option than to embed my external library SWF’s, the simplest of which is just an SWF full of images in the library.

My normal method is this

```php
public function loadSWF():void {
            var url:String = swfPath+queue[0];
            var current:ApplicationDomain = ApplicationDomain.currentDomain;
            var context:LoaderContext = new LoaderContext();
            context.applicationDomain = current;
            //
            loader = new Loader();
            loader.contentLoaderInfo.addEventListener(Event.COMPLETE, SWFcomplete);
            loader.load(new URLRequest(url), context);
        }
        //
        private function SWFcomplete(e:Event):void {
            assetDomain = e.target.applicationDomain;
            loader.contentLoaderInfo.removeEventListener(Event.COMPLETE, SWFcomplete);
            queue.shift();
            if (queue.length == 0) {
                finishLoading();
            } else {
                loadAssets();
            }
            //
        }

```

Then I can access the classes of an externally loaded SWF like this

```php
var currentDomain:ApplicationDomain = ApplicationDomain.currentDomain;
var modelClass:Class = currentDomain.getDefinition(className) as Class;

```

I embed it like this

```php

[Embed(source="assets/TextureLibrary.swf")]
private var textureLibrary:Class;

```

The embedded SWF is embedded as a “MovieClipLoaderAsset”, the thing is I just have no clue what to do with it, and how to access the classes it contains like the above method for an external SWF.

Any ideas?

Cheers,  
RumbleSushi
