# Passing a var to external swf in AS3

**URL:** <https://forum.kirupa.com/t/passing-a-var-to-external-swf-in-as3/270641>\
**Category:** flash\
**Created:** [September 11, 2008, 9:02pm UTC](https://forum.kirupa.com/t/passing-a-var-to-external-swf-in-as3/270641 "2008-09-11T21:02:01Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![dbdvd7](https://avatars.discourse-cdn.com/v4/letter/d/f07891/32.png) [@dbdvd7](https://forum.kirupa.com/u/dbdvd7)\
**Post date:** [September 11, 2008, 9:02pm UTC](https://forum.kirupa.com/t/passing-a-var-to-external-swf-in-as3/270641/1 "2008-09-11T21:02:01Z")

</div>

I have been messing with this problem for far to long today, it has to have a simple answer. In my main swf I have a location variable, 1 and 2. it determines different things to display based on the location chosen. I have one instance where I pass the loc variable to a movieclip nested in the root. I used:  
MovieClip(calendar\_mc).locPos = loc;

This works fine. It passes the correct var into that movieclip and the correct calendar pops up. Now when I load an external swf I cannot figure out how to pass this along. I use:  
ActionScript Code:  
[LEFT][COLOR=#000000] **function** [/COLOR] extPackCOLOR=#000000[/COLOR]  
[COLOR=#000000]{[/COLOR]  
packLoader.[COLOR=#0000FF]load[/COLOR][COLOR=#000000]([/COLOR][COLOR=#000000] **new** [/COLOR] URLRequestCOLOR=#000000[/COLOR][COLOR=#000000])[/COLOR];  
packLoader.[COLOR=#000080]contentLoaderInfo[/COLOR].[COLOR=#000080]addEventListener[/COLOR][COLOR=#000000]([/COLOR]ProgressEvent.[COLOR=#000080]PROGRESS[/COLOR], spinMe[COLOR=#000000])[/COLOR];  
packLoader.[COLOR=#000080]contentLoaderInfo[/COLOR].[COLOR=#000080]addEventListener[/COLOR][COLOR=#000000]([/COLOR]Event.[COLOR=#000080]COMPLETE[/COLOR], showMe[COLOR=#000000])[/COLOR];  
mtFrame.[COLOR=#000080]addChild[/COLOR]COLOR=#000000[/COLOR];  
[COLOR=#000000]}[/COLOR]  
[COLOR=#000000] **function** [/COLOR] showMeCOLOR=#000000[/COLOR]:[COLOR=#0000FF]void[/COLOR]  
[COLOR=#000000]{[/COLOR]  
[COLOR=#0000FF]MovieClip[/COLOR]COLOR=#000000[/COLOR].[COLOR=#000080]loc[/COLOR] = loc;  
[COLOR=#000000]}[/COLOR]  
[/LEFT]

Ive tried mtFrame.packLoader.loc = loc;  
mtFrame.packLoader.content.loc = loc;  
etc etc. but to no avail. Does anyone have any idea whats wrong here? In my external clip, there is a loop constantly checking loc to = 1 or 2 and execute accordingly. It works fine, This var is just not getting passed in. Thanks in advance
