# How to Pass Vars from external swf (as child) to parent?

**URL:** <https://forum.kirupa.com/t/how-to-pass-vars-from-external-swf-as-child-to-parent/287600>\
**Category:** Uncategorized\
**Created:** [May 4, 2009, 7:13am UTC](https://forum.kirupa.com/t/how-to-pass-vars-from-external-swf-as-child-to-parent/287600 "2009-05-04T07:13:11Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![swathi84\_k](https://avatars.discourse-cdn.com/v4/letter/s/8dc957/32.png) [@swathi84\_k](https://forum.kirupa.com/u/swathi84_k)\
**Post date:** [May 4, 2009, 7:13am UTC](https://forum.kirupa.com/t/how-to-pass-vars-from-external-swf-as-child-to-parent/287600/1 "2009-05-04T07:13:11Z")

</div>

Hi …

I am new to flash.“I am unable to access the variables of child swf in parent swf after an action(button is clicked) is performed in child swf”.

My problem is i had 2 swfs parent.swf and child .swf and i loaded the child.swf file in parent.swf using Loader class there is a textbox and a button in child.swf when we enter text in the textbox(say,notepanel\_txt) and click on the button(say, mySubmit) the text present in textbox(notepanel\_txt.text) is saved in the database using URLLoader and an variable called success(which is String type) must be available to parent. the code is as follows:

**parent.fla**

* * *

--------------blah… blah…

var textLdr:Loader=new Loader();  
var noteUrl:String = “child.swf”;  
var urlReq:URLRequest=new URLRequest(noteUrl);

```
    textLdr.load(urlReq);

    addChild(textLdr);

```

**child.fla**

* * *

* * *

-------------blah… blah…  
mySubmit.addaddEventListener(MouseEvent.CLICK,onClick);  
function onClick(evnt:MouseEvent):void {

var url:String = "[http://localhost:8888/addvalues";](http://localhost:8888/addvalues%22;)

var urlLoader:URLLoader = new URLLoader();  
urlLoader.dataFormat = URLLoaderDataFormat.TEXT;

```
var request:URLRequest = new URLRequest(url);
var variables:URLVariables = new URLVariables();

```

variables.notevalue= notepanel\_txt.text;

```
request.data = variables;

urlLoader.addEventListener(Event.COMPLETE, completeHandler1);

```

urlLoader.load(request);

function completeHandler1(event:Event):void {

var success:String = “Added Successfully”; \*\* [SIZE=3]// this String value must be passed to parent.fla[/SIZE]**[SIZE=3]** from child.fla\*\*[/SIZE]

}  
}

I think, you feel free for posting reply to this post.So, spend 3 min.s of your time in filling with reply on behalf of me.

Please Help me… Its Urgent…  
Thanks in Advance

Swathi
