Passing variables to and from externally loaded SWF?

I have an SWF, called main.swf. Inside of that is a movieClip that Declares a variable “myVar”.

Then there is an external SWF that is loaded by main.swf. I am trying to get this external SWF to check the value of “myVar” and depending on what the value is, send the playhead in the main.swf to a certain frame.

I have it almost working, but it is giving me problems. And I am not sure it is the best way to do it.
1)
On the timeline of main.swf is a movieClip called “BG”. It has 6 frames. the first frame declares that variable, and each of the other 5 frames, set the value of it.
2)
I need the external swf to check the value of “myVar” to detemine where to send the playhead of the mian.swf. So on a frame in the external SWF, I have this code:
Code:
MovieClip(parent).addEventListener(Event.ENTER_FRAME, fl_EnterFrameHandler); function fl_EnterFrameHandler(event:Event):void { dispatchEvent(new Event(“myVar_value”, true)); }
3)

Then on the main.swf timeline, I have this code to capture the dispatch and trigger the function:
Code:
addEventListener(“myVar_value”, habitatBG) function habitatBG(event:Event):void{ if (myVar == “seashore”) { gotoAndStop(“seashore_critters”); } }
However this doesn’t work and it says:

Code:
1120: Access of undefined property myVar. 

I basically need to check a variable and send the main.swf to a certain frame. Does anyone know how I can do this?