# Button to load contentPath and External Text Problem

**URL:** <https://forum.kirupa.com/t/button-to-load-contentpath-and-external-text-problem/185399>\
**Category:** Uncategorized\
**Created:** [April 13, 2006, 1:25am UTC](https://forum.kirupa.com/t/button-to-load-contentpath-and-external-text-problem/185399 "2006-04-13T01:25:19Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![nemedia](https://avatars.discourse-cdn.com/v4/letter/n/7ba0ec/32.png) [@nemedia](https://forum.kirupa.com/u/nemedia)\
**Post date:** [April 13, 2006, 1:25am UTC](https://forum.kirupa.com/t/button-to-load-contentpath-and-external-text-problem/185399/1 "2006-04-13T01:25:19Z")

</div>

i have the following layers:

Gallery - containt mx.controls.load named art1Loader  
Gallery Info - Dynamic Text Box named infoBox  
Gallery Buttons - btn1

i have the following script within btn1

on(release){  
art1Loader.contentPath = “images/artists/artist1/exam1.jpg”;  
}  
loadText = new loadVars();  
loadText.load(“txt/art/artist1/TEXT1.txt”);  
loadText.onLoad = function(success) {  
if (success) {  
// trace(success);  
infoBox.html = true;  
infoBox.htmlText = this.info;  
}  
};  
}

i get the follwing errors:

**Warning** Symbol=Test Clip , layer=GaleryButtons, frame=2:Line 4: The identifier ‘loadVars’ will not resolve to built-in object ‘LoadVars’ at runtime.  
loadText = new loadVars();

**Error** Symbol=Test Clip , layer=GaleryButtons, frame=2:Line 5: Statement must appear within on handler  
loadText.load(“txt/art/artist1/TEXT1.txt”);

**Error** Symbol=Test Clip , layer=GaleryButtons, frame=2:Line 6: Statement must appear within on handler  
loadText.onLoad = function(success) {

**Error** Symbol=Test Clip , layer=GaleryButtons, frame=2:Line 13: Unexpected ‘}’ encountered  
}

Total ActionScript Errors: 4 Reported Errors: 4

Ok so im new to this somebody please help?

---

<div class="post-metadata">

**Author:** ![Macaroni\_Ted](https://avatars.discourse-cdn.com/v4/letter/m/df788c/32.png) [@Macaroni\_Ted](https://forum.kirupa.com/u/Macaroni_Ted)\
**Post date:** [April 13, 2006, 1:59am UTC](https://forum.kirupa.com/t/button-to-load-contentpath-and-external-text-problem/185399/2 "2006-04-13T01:59:19Z")

</div>

try

[AS]on (release) {  
art1Loader.contentPath = “images/artists/artist1/exam1.jpg”;  
loadText = new LoadVars();  
loadText.load(“txt/art/artist1/TEXT1.txt”);  
loadText.onLoad = function(success) {  
if (success) {  
// trace(success);  
infoBox.html = true;  
infoBox.htmlText = this.info;  
}  
};  
}[/AS]

---

<div class="post-metadata">

**Author:** ![nemedia](https://avatars.discourse-cdn.com/v4/letter/n/7ba0ec/32.png) [@nemedia](https://forum.kirupa.com/u/nemedia)\
**Post date:** [April 13, 2006, 2:07am UTC](https://forum.kirupa.com/t/button-to-load-contentpath-and-external-text-problem/185399/3 "2006-04-13T02:07:37Z")

</div>

> [@Macaroni Ted](#):
>
> try
> 
> ```
> ActionScript Code:
> [FONT=Courier New][LEFT][COLOR=#0000FF]on[/COLOR] [COLOR=#000000]([/COLOR]release[COLOR=#000000])[/COLOR] [COLOR=#000000]{[/COLOR]
> 
> ```
> 
> &nbsp;&nbsp;&nbsp;&nbsp;art1Loader.[COLOR=#000080]contentPath[/COLOR] = [COLOR=#FF0000]“images/artists/artist1/exam1.jpg”[/COLOR];  
> &nbsp;&nbsp;&nbsp;&nbsp;loadText = [COLOR=#000000] **new** [/COLOR] [COLOR=#0000FF]LoadVars[/COLOR]COLOR=#000000[/COLOR];  
> &nbsp;&nbsp;&nbsp;&nbsp;loadText.[COLOR=#0000FF]load[/COLOR]COLOR=#000000[/COLOR];  
> &nbsp;&nbsp;&nbsp;&nbsp;loadText.[COLOR=#0000FF]onLoad[/COLOR] = [COLOR=#000000] **function** [/COLOR]COLOR=#000000[/COLOR] [COLOR=#000000]{[/COLOR]  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if COLOR=#000000[/COLOR] [COLOR=#000000]{[/COLOR]  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[COLOR=#808080]_// trace(success);_[/COLOR]  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;infoBox.[COLOR=#0000FF]html[/COLOR] = [COLOR=#000000] **true** [/COLOR];  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;infoBox.[COLOR=#0000FF]htmlText[/COLOR] = [COLOR=#0000FF]this[/COLOR].[COLOR=#000080]info[/COLOR];  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[COLOR=#000000]}[/COLOR]  
> &nbsp;&nbsp;&nbsp;&nbsp;[COLOR=#000000]}[/COLOR];  
> [COLOR=#000000]}[/COLOR]  
> [/LEFT]  
> [/FONT]

superstar it works perfectly cheers

---

<div class="post-metadata">

**Author:** ![Macaroni\_Ted](https://avatars.discourse-cdn.com/v4/letter/m/df788c/32.png) [@Macaroni\_Ted](https://forum.kirupa.com/u/Macaroni_Ted)\
**Post date:** [April 13, 2006, 2:21am UTC](https://forum.kirupa.com/t/button-to-load-contentpath-and-external-text-problem/185399/4 "2006-04-13T02:21:32Z")

</div>

> [@nemedia](#):
>
> superstar it works perfectly cheers

np 🍺
