# Accessing Embedded Content

**URL:** <https://forum.kirupa.com/t/accessing-embedded-content/265478>\
**Category:** flash\
**Created:** [July 9, 2008, 12:25pm UTC](https://forum.kirupa.com/t/accessing-embedded-content/265478 "2008-07-09T12:25:31Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![TastyLamp](https://avatars.discourse-cdn.com/v4/letter/t/22d042/32.png) [@TastyLamp](https://forum.kirupa.com/u/TastyLamp)\
**Post date:** [July 9, 2008, 12:25pm UTC](https://forum.kirupa.com/t/accessing-embedded-content/265478/1 "2008-07-09T12:25:31Z")

</div>

I’ve created a MovieClip in Flash CS3 and wrote in it’s timeline:

```auto
function testFunction():void
{
rotation = 45;
}

```

I have then selected to export this MovieClip as ‘TestClip’ on the first frame, with a base class of flash.display.MovieClip. I compile the SWF as ‘test.swf’, and then embed it into my ActionScript project like so:

```auto
[Embed(source='test.swf', symbol='TestClip')]
private static const TestClip:Class;

```

I can then instantiate the embedded object I’ve created, and add it to the display list, but I’m wondering how I can call the testFunction() that I defined in Flash CS3 from my instantiated object?

```auto
var testClip:Sprite = new TestClip();
testClip.testFunction(); //? This does not work, as testFunction is not a method of Sprite.

```

Is there a way of doing this that I’m missing? Thanks in advance.

---

<div class="post-metadata">

**Author:** ![senocular](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/senocular/32/7217_2.png) [@senocular](https://forum.kirupa.com/u/senocular)\
**Post date:** [July 9, 2008, 12:31pm UTC](https://forum.kirupa.com/t/accessing-embedded-content/265478/2 "2008-07-09T12:31:01Z")

</div>

I assume you’re using Flex? I don’t use Flex so I don’t know the intricacies of of Embed, but try not assigning a type to your testClip variable. The type determines what properties are available to your instance and Sprite obviously isn’t defined with a testFunction natively 😉

---

<div class="post-metadata">

**Author:** ![TastyLamp](https://avatars.discourse-cdn.com/v4/letter/t/22d042/32.png) [@TastyLamp](https://forum.kirupa.com/u/TastyLamp)\
**Post date:** [July 9, 2008, 12:37pm UTC](https://forum.kirupa.com/t/accessing-embedded-content/265478/3 "2008-07-09T12:37:49Z")

</div>

Yeah untyping the variable gives me a runtime error that it cannot find property testFunction in TestClip.

I’m lost. Surely there’s a simple way of talking between ActionScript-only Flex projects and Flash CS3 symbols?

---

<div class="post-metadata">

**Author:** ![senocular](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/senocular/32/7217_2.png) [@senocular](https://forum.kirupa.com/u/senocular)\
**Post date:** [July 9, 2008, 12:48pm UTC](https://forum.kirupa.com/t/accessing-embedded-content/265478/4 "2008-07-09T12:48:12Z")

</div>

there’s  
[http://www.adobe.com/cfusion/exchange/index.cfm?event=extensionDetail&loc=en\_us&extid=1273018](http://www.adobe.com/cfusion/exchange/index.cfm?event=extensionDetail&loc=en_us&extid=1273018)

Its also included in the Flex 3 SDK

I don’t know if it works with AS projects, though.

---

<div class="post-metadata">

**Author:** ![senocular](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/senocular/32/7217_2.png) [@senocular](https://forum.kirupa.com/u/senocular)\
**Post date:** [July 9, 2008, 12:55pm UTC](https://forum.kirupa.com/t/accessing-embedded-content/265478/5 "2008-07-09T12:55:17Z")

</div>

It might be possible embedding SWFs creates a wrapper as well, similar to a Loader object. I seem to be remembering something like that (dug up from the dark depths of my vacuous mind).

Ah! found this!  
[http://livedocs.adobe.com/flex/3/langref/mx/core/MovieClipAsset.html](http://livedocs.adobe.com/flex/3/langref/mx/core/MovieClipAsset.html)  
Should help

---

<div class="post-metadata">

**Author:** ![TastyLamp](https://avatars.discourse-cdn.com/v4/letter/t/22d042/32.png) [@TastyLamp](https://forum.kirupa.com/u/TastyLamp)\
**Post date:** [July 9, 2008, 1:03pm UTC](https://forum.kirupa.com/t/accessing-embedded-content/265478/6 "2008-07-09T13:03:05Z")

</div>

Just tried using the Flex Components command thing, to no avail. The MovieClipAsset class doesn’t help much either. I decompiled a few of my swfs to see what’s going on, and it just seems that when embedding, Flex doesn’t carry over anything but the graphics of the symbol. I might have to do this another way (with Loader probably).

Sort of sucks. Ah well. Thanks senocular. Coincidentally, you’ve been the guy that’s always helped me whenever I post here lol.
