# Moving code from Movie clip to frames

**URL:** <https://forum.kirupa.com/t/moving-code-from-movie-clip-to-frames/285920>\
**Category:** flash\
**Created:** [April 7, 2009, 8:38pm UTC](https://forum.kirupa.com/t/moving-code-from-movie-clip-to-frames/285920 "2009-04-07T20:38:16Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![last](https://avatars.discourse-cdn.com/v4/letter/l/ecae2f/32.png) [@last](https://forum.kirupa.com/u/last)\
**Post date:** [April 7, 2009, 8:38pm UTC](https://forum.kirupa.com/t/moving-code-from-movie-clip-to-frames/285920/1 "2009-04-07T20:38:16Z")

</div>

Please help in converting the code to use LOAdVARS so that all code is located on the Main Timeline.Attached are the old file(Addressbok) and what I cureently have converted  
(addressbook2)  
The code uses on onClipEvent(data) and onClipEvent(Load) which is on the firstframe in:

```auto
onClipEvent(data)
{
 strName = Name;
 strTelephone = Telephone;
 strCity = City;
 strNotes = Notes;
 strPosition = "Record " add String(CurrentRecord+1) add " of " add String(TotalRecords);
}
onClipEvent(load)
{
 CurrentRecord = 0;
 loadVariables ("getdetails.asp?Record=0", this);
}

```

The code on the button is

```auto
[[FONT=Arial][COLOR=#0000ff]on (release)[/COLOR][/FONT]
[FONT=Arial][COLOR=#0000ff]{[/COLOR][/FONT]
[FONT=Arial][COLOR=#0000ff] CurrentRecord++;[/COLOR][/FONT]
[FONT=Arial][COLOR=#0000ff] if (CurrentRecord == TotalRecords)[/COLOR][/FONT]
[FONT=Arial][COLOR=#0000ff] CurrentRecord = 0;[/COLOR][/FONT]
 
[FONT=Arial][COLOR=#0000ff] loadVariables ("getdetails.asp?Record=" add String(CurrentRecord), this);[/COLOR][/FONT]
[FONT=Arial][COLOR=#0000ff]}[/COLOR][/FONT]

```

My Code so far as i would like it to be is :

```auto
var send_lv:LoadVars = new LoadVars();
send_lv.onLoad = function(success:Boolean):Void {
name_txt.text=send_lv.Name;
telephone_txt.text=send_lv.Telephone;
city_txt.text=send_lv.City;
notes_txt.text=send_lv.Notes;
}
send_lv.sendAndLoad("GetDetails.asp", send_lv, "GET");

```
