I’m creating a searchable database in Flash where all the content loads dynamically from external sources. the main interface is columns of buttons where clicking in the first column sends the user to a named frame with a second column of buttons, then onto the third column then the final content is loaded into a new movie clip.
The interface uses just one button(a movie clip) and the columns of buttons are created with a duplicateMovieClip function. that part works fine.
However I can’t get the button labels to load from an external text file even though I’m using the explicit button names, and I can’t get the buttons to react to clicks even though they’re “hot”, i.e., the cursor changes when I mouse over them. the button behaviors use the dynamic button names.
Here’s my code, any suggestions appreciated:
//creates a load Variables object
loadText = new LoadVars();
loadText.load("text/patent01NumbersText.txt");
//this makes a column of duplicate button movie clips
for (i=0;i<13;i++){
duplicateMovieClip("patentBtn_mc", "patentBtn"+i+"_mc", i);
this["patentBtn"+i+"_mc"]._y = this["patentBtn"+i+"_mc"]._height * i;
};
loadText.onLoad = function(){
patentBtn0_mc.btnLabel_mc.btnLabel_txt.text = this.patentBtn01;
patentBtn1_mc.btnLabel_mc.btnLabel_txt.text = this.patentBtn02;
patentBtn2_mc.btnLabel_mc.btnLabel_txt.text = this.patentBtn03;
};
//this function simply resets all the movieclips to their original up state
//after all mcs have been reset the conditional (if) statement will highlight the appropriate button
function clearAll(){
["patentBtn"+i+"_mc"]gotoAndStop("up");
};
//sets the button frame to go to for up, over and down states
function up(){
this["patentBtn"+i+"_mc"].gotoAndStop("up");
};
function over(){
this["patentBtn"+i+"_mc"].gotoAndStop("over");
};
function active(){
this["patentBtn"+i+"_mc"].gotoAndStop("active");
};
//Should cause the main timeline to advance one frame and stop
["patentBtn"+i+"_mc"]onPress = function():Void {
_root.gotoAndStop(Patent01);
};
this["patentBtn"+i+"_mc"].onRollOver = over;
this["patentBtn"+i+"_mc"].onRollOut = up;
this["patentBtn"+i+"_mc"].onRelease = function(){
gotoAndStop("Patent0"+i);
clearAll();
};
//the if statement that highlights the active button
_root.onEnterFrame = function(){
if (_root.framename == "Patent01") {
this.Menu01_mc.patentBtn01_mc.gotoAndStop("active");
};
};