# Please help....need help to load text dynamically

**URL:** https://forum.kirupa.com/t/please-help-need-help-to-load-text-dynamically/230601
**Category:** Uncategorized
**Created:** [June 27, 2007, 4:20pm UTC](https://forum.kirupa.com/t/please-help-need-help-to-load-text-dynamically/230601 "2007-06-27T16:20:54Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![andyryan](https://avatars.discourse-cdn.com/v4/letter/a/edb3f5/32.png) [@andyryan](https://forum.kirupa.com/u/andyryan)
#### Post date: [June 27, 2007, 4:20pm UTC](https://forum.kirupa.com/t/please-help-need-help-to-load-text-dynamically/230601/1 "2007-06-27T16:20:54Z")

</div>

hi,

I am doing this project for a friend unpaid and the deadline is very tight. Id love somebody to help me.

Ive got a code that a couple of guys here cooked up for me a while ago for a photogallery. For a series of buttons when pressed, it increases the alpha of a box to 100% to block out a photo. it then swaps this photo for another one (corresponding to the button pressed)…when that has loaded it decreases the alpha of the box to 0% to reveal the new photo. I would like to edit this to add a corresponding body of text for each photo that is also dynamically loaded and then revealed by the same white box. Any one help me?

/\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
IMPORTS  
_**/  
import mx.transitions.Tween;  
import mx.transitions.easing.\*;  
/**_  
VARS  
_**/  
var button\_tween:Object;  
var container\_mcl:MovieClipLoader = new MovieClipLoader();  
var mcl\_listener:Object = new Object();  
var number\_of\_images:Number = 5;  
/**_  
EVENTS  
_**/  
mcl\_listener.onLoadProgress = function(target\_mc:MovieClip, loadedBytes:Number, totalBytes:Number):Void {  
var percentage:Number = Math.round((loadedBytes/totalBytes) \* 100);  
trace (percentage + “% loaded”);  
}  
mcl\_listener.onLoadComplete = function(target\_mc:MovieClip) {  
button\_tween = new Tween(target\_mc.\_parent.white\_block, “\_alpha”, Strong.easeInOut, 100, 0, 24, false);  
}  
/**_  
FUNCS  
_**/  
function initiate\_button\_events():Void {  
for (var i:Number = 0; i\<number\_of\_images; i++) {  
var targetButton\_mc:MovieClip = this[“button\_”+i];  
targetButton\_mc.imageID = i;  
targetButton\_mc.onRelease = function():Void {  
button\_tween = new Tween(this.\_parent.white\_block, “\_alpha”, Strong.easeInOut, 0, 100, 24, false);  
var obj=this  
button\_tween.onMotionFinished = function():Void {  
var image\_to\_load:String = “image”+obj.imageID+".jpg";  
container\_mcl.loadClip(image\_to\_load,container\_mc);  
};  
};  
}  
}  
/**_  
RUN, \*\*\*\*\*!  
\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*/  
loadVariables(“text0.txt”,"\_root.textbox\_mc");  
container\_mc.loadMovie(“image0.jpg”);  
initiate\_button\_events()  
white\_block.\_alpha = 0;  
container\_mcl.addListener(mcl\_listener);  
stop();
