# Problem passing a var between ext SWF and main project

**URL:** <https://forum.kirupa.com/t/problem-passing-a-var-between-ext-swf-and-main-project/293121>\
**Category:** flash\
**Created:** [July 23, 2009, 1:24pm UTC](https://forum.kirupa.com/t/problem-passing-a-var-between-ext-swf-and-main-project/293121 "2009-07-23T13:24:48Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![humbucker](https://avatars.discourse-cdn.com/v4/letter/h/278dde/32.png) [@humbucker](https://forum.kirupa.com/u/humbucker)\
**Post date:** [July 23, 2009, 1:24pm UTC](https://forum.kirupa.com/t/problem-passing-a-var-between-ext-swf-and-main-project/293121/1 "2009-07-23T13:24:48Z")

</div>

Hi again,

I’m facing a little problem passing a var from my external swf to my main project.  
I’m using a document class to pilot my main project.

This is the function stored in my main project’s document class file :

```auto

    public function dischargeExtContent(m:int):void {
    id=m;
    trace(id);
    }        

```

and this is the code in my external swf :

```auto

but1.id = 5;
but1.buttonMode = true;
but1.mouseEnabled = true;
but1.addEventListener(MouseEvent.MOUSE_DOWN, chargeMaster);

function chargeMaster(m:MouseEvent):void {
        var id = m.target.id;        
        MovieClip(this.parent.parent.parent.parent).dischargeExtContent(id);

```

When I test, I see that the dischargeExtContent is run (cause I got an animation) but the trace id returnes UNDEFINED.

i’m not comfortable with static vars and so on so I choose this solution, can you maybe give me a hand on this ??

Thanks a lot
