Calling a function through a parameter

The following contains modified back and next button code that keeps a navigation/frame history until you reach the last location. Then the buttons trigger the last or next location (URL) in your browser.

This is good if you are looking to create a flash site with a few different html pages *home.html>about us.html; about Jack frame; about Jill frame *, though I haven’t figured out how to pass the history to the ‘next’ or ‘previous’ flash movie when navigating to a new URL.

The goal is to change the frame navigation-based history to function call-based history.

:q: Question 1: How can I call a function through a parameter?

 Lets say I have a function called **run(theFunction, parameters)** that has the parameter **(_root.LaunchURL, myLink.html)** and within the run function it passes the variable **thisFunctionCall=theFunction;**then attempts to call the passed variable as a function **thisFunctionCall(parameters);**. At this point nothing happens. Why? How can it be set to happen?

:q: ** Question 2: What is the best way to do the following? **

:*( I’m not too shabby at interface design and imagining ‘the machine’ but my experience in coding (or lack there of) can turn into code-calling-movieclip/timeline sloppy.

:egg: Each ‘page’ is created from variables and function calls located in externally loaded html/xml. The ‘page’ is basically a template (an empty slate, a component for video, or a movieclip for text), for whatever content it contains (text, image gallery, video, etc). I imagine these ‘pages’ are frames (containing the desired movieclip) called upon and defined using variables called upon from the externally loaded html/xml (videopage dynamically loading external movie 5). I only imagine the ‘pages’ as frames because I am less familiar with creating prototypes or empty movieclips. If you feel these or others are more effective than frames, let me know. Any advice for further learning is appreciated, as well as any recommendations to keep clean code (syntax, variables, xml, etc).

:eye: example: A ‘text page’ containing a *textArea component * with dynamically loaded html formatted in css and further ability to call functions through fscommand and load any text within itself at runtime.
So the function call I make might look like run(_root.GoTotextPageFunction,textPageBio), GoTotextPageFunction is the function passed through run’s parameter, and textPageBio is the loaded text. An image ‘gallery page’ defined using by xml with the benefit of using xml to call upon different galleries at runtime.

stop();
// Creates an array to store back and next navigation history.
var backHistory = new Array();
var nextHistory = new Array();
// Ideally this (goto) will be changed to function Run(theFunction, theParameters) {
function goto(theLabel) {
// If the destination is not the same as the current
// location...
  if (theLabel != backHistory[backHistory.length - 1]) {
    // ...add the destination to the backHistory
    backHistory.push(theLabel);
    // currently sends the playhead to the destination. *I want it to call the passed function with parameters here.
    gotoAndStop(backHistory[backHistory.length - 1]);
  }
}

function goBack() {
  // ...add the last location to the nextHistory.
  nextHistory.push(backHistory[backHistory.length - 1]);
// Remove the last location from backHistory.
  backHistory.pop();

  // If we're not all the way back home...
  if (backHistory.length > 0) {
    // display the previous location
    gotoAndStop(backHistory[backHistory.length - 1]);
  } else {
    // otherwise, go to the last URL.
    getURL("javascript:history.go(-1)");
  }
}
function goNext() {
  // If we're not at the farthest navigation destination...
  if (nextHistory.length > 0) {
// ...add the destination in nextHistory to the backHistory
	backHistory.push(nextHistory[nextHistory.length - 1]);
// display the next location from nextHistory
    gotoAndStop(nextHistory[nextHistory.length-1]);
	// Remove the last location from the nextHistory.
	nextHistory.pop();
  } else {
     // otherwise, go to the next URL.
    getURL("javascript:history.go(+1)");
  }
}

Thanks for anyone daring to tackle this web of challenge :h: or can aid in some general advice.

-Mike