# Re-useable swf / importing text

**URL:** <https://forum.kirupa.com/t/re-useable-swf-importing-text/261567>\
**Category:** flash\
**Created:** [May 28, 2008, 10:15pm UTC](https://forum.kirupa.com/t/re-useable-swf-importing-text/261567 "2008-05-28T22:15:15Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![c03cg](https://avatars.discourse-cdn.com/v4/letter/c/958977/32.png) [@c03cg](https://forum.kirupa.com/u/c03cg)\
**Post date:** [May 28, 2008, 10:15pm UTC](https://forum.kirupa.com/t/re-useable-swf-importing-text/261567/1 "2008-05-28T22:15:15Z")

</div>

Im creating a flipping boook for a friend, who will occasionally need to update pages / text, but without using flash.

All of the text for the individual pages is stored in a single text file (pageText.txt) in the format:

```auto
page1=Page One's Text
page2=Page Two's Text
page3=Page Three's Text...etc

```

Each page is a clone of a single .swf which will simply load the relevant text.  
I’ve hard coded this to get page 1’s text, which works fine:

```auto
loadData = new LoadVars();
loadData.onLoad = function() 
{
  page_txt.html=true;
  page_txt.htmlText = this.page1;
};
loadData.load("pageText.txt"); 

```

However this would mean changing

```auto
page_txt.htmlText = this.page1

```

for each individual .swf. Is there any way of using the filename (page1.swf, page2.swf) to set the ‘this.pageX’ statement?

Cheers

Chris

---

<div class="post-metadata">

**Author:** ![c03cg](https://avatars.discourse-cdn.com/v4/letter/c/958977/32.png) [@c03cg](https://forum.kirupa.com/u/c03cg)\
**Post date:** [May 31, 2008, 11:28am UTC](https://forum.kirupa.com/t/re-useable-swf-importing-text/261567/2 "2008-05-31T11:28:15Z")

</div>

As there doesn’t seem to be any other options i’ve gone for a big switch statement which uses the number from the .swf file (page1, page2 etc) to decide which text to load.
