[as2.0] strange variable results w/eventlistener function

So I’ve got a function that does several things:
It creates video cue points, loads content & executes a function based on those cue points, and finally, sets the eventlistener for the video.

The problem I’m having (after tracing it out) is that the variables within the function seem to be stored as an ‘array-like’ deal. In other words, the variables output as they should when initially clicked. Next time the code executes, it outputs the newest variable values then IMMEDIATELY the first variable values. This output ‘builds’ and builds but ultimately the content never dynamically changes as it always ends up loading the first content that was loaded very first time out. I’m guessing it has something to do with the event listener being re-instantiated? Tried modifying where I add the listener to no avail.

Any thoughts?


function vidPlay(vidName) {
    swfText.gotoAndStop(1); // mc1 to load external data & play a function
    swfText._alpha = 100;
    swfImage.unloadMovie();
    swfImage._alpha = 100; // duplicate of mc1 but different instance with different name
 // tweens inserted here. Removed for brevity
FLVPlybk.contentPath = vidName;
FLVPlybk.play();
import mx.video.*;
/* Cue Points*/
var cuePt0:Object = new Object();cuePt0.time = .5;cuePt0.name = "timed";cuePt0.type = "actionscript";
var cuePt1:Object = new Object();cuePt1.time = 4;cuePt1.name = "load1";cuePt1.type = "actionscript";
var cuePt2:Object = new Object();cuePt2.time = 5;cuePt2.name = "load2";cuePt2.type = "actionscript";
FLVPlybk.addASCuePoint(cuePt0);
FLVPlybk.addASCuePoint(cuePt1);
FLVPlybk.addASCuePoint(cuePt2);
var listenerObject:Object = new Object();
listenerObject.cuePoint = function(eventObject:Object):Void  {

if (eventObject.info.name == "timed") {
    sendIt = FLVPlybk.totalTime - 10;
    var cuePt3:Object = new Object();cuePt3.time = sendIt;cuePt3.name = "unload";cuePt3.type = "actionscript";
    FLVPlybk.addASCuePoint(cuePt3); // The first cuepoint grabs total time and creates the last cuepoint.
    };
if (eventObject.info.name == "load1") {
    tLength = vidName.length - 4;
    extName = vidName.substring(7,tLength); // strips vid name to just it's name; no full url and no extension
    var fileLoad:String = "text/"+extName+".txt"; // locate text file with same name as video
    /* Load Text */
    myData = new LoadVars();
    myData.onLoad = function() {
        swfText.swfTextXML = this.myVariable;
        TypeIt();swfText.gotoAndStop(2); // once loaded, mc1 goes to next frame and executes Typeit which types info onstage in mc.
    };
myData.load(fileLoad);
};
if (eventObject.info.name == "load2") {
    tLength = vidName.length - 4;
    var extName2 = vidName.substring(7,tLength); // start @ 7 to remove 'videos/' & end at length - 4 to remove ext
    var fileLoad2:String = "images/video/"+extName2+".png";
    swfImage.loadMovie(fileLoad2);
    };
if (eventObject.info.name == "unload") {
    tweenObj = new Tween (swfText, "_alpha", Strong.easeOut, _root.swfText._alpha, 0, 1.0, true);
    tweenObj.onMotionChanged = function() {
        tweenObj = new Tween (swfImage, "_alpha", Strong.easeOut, _root.swfImage._alpha, 0, 1.0, true);
    }
    };
};
FLVPlybk.addEventListener("cuePoint",listenerObject);
}

I still haven’t been able to figure this one out. My best guess is something to do with the eventlistener being re-instatiated each time the function is called, but I’m not sure. Again, it seems to either be ‘storing’ the variables in a backwards array somehow (first variable is stored and accessed last at all times) or maybe somehow it’s creating multiple instances of the eventlistener and the variables are being pulled from the first iteration of it. Dunno. Thanks in advance.