I done tried and tried to fix this thing, but for some reason, activating my navigation renders my reference variables (goalX and goalY) “undefined.” I would post these files, but they have confidential data. If necessary, I can replace the bmps with garbage. Hopefully, if I give the code and the debug output, someone can crack this puzzle.
There are four containers holding SWFs in this movie. One container (nav) holds the navigation, another (dataFile) holds an Excel spreadsheet bmp (this SWF delivers the values for the x and y arrays), another (head) holds the column headings, and a forth container holds tab buttons. The nav container includes navigation with four buttons, one for each direction. An _root array for x and another for y holds the various positions for head and dataFile (loaded from the dataFile container) .
Here is the _root code:
Here is the code loaded from the dataFile SWF:Code:var i:Number = 0; var u:Number = 0; var goalY:Number = 150; var goalX:Number = 0; var myXArray:Array = new Array; myXArray=[u]; var myYArray:Array = new Array; myYArray=[i]; nav._alpha=35; nav.onRollOver=function(){ nav._alpha=100; }; nav.onRollOut=function(){ nav._alpha=25; }; //Loading the first container++++++++++++++++++++++++++++++++++++++++++++++++++ this.createEmptyMovieClip("dataFile", this.getNextHighestDepth()); var mc1Listener:Object = new Object(); mc1Listener.onLoadInit = function(_loadedMC1:MovieClip) { if (_loadedMC1 == _root.dataFile){ _loadedMC1._x = 0; _loadedMC1._y = 150; trace(dataFile._y); }else{ trace("I'm afraid _loadedMC1 didn't load, or is not defined!" + _loadedMC1); } }; var MCdata:MovieClipLoader = new MovieClipLoader(); MCdata.addListener(mc1Listener); MCdata.loadClip("Summary.swf",this.dataFile); //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //Loading the second container++++++++++++++++++++++++++++++++++++= this.createEmptyMovieClip("head", this.getNextHighestDepth()); var mc2Listener:Object = new Object(); mc2Listener.onLoadInit = function(_loadedMC2:MovieClip) { if (_loadedMC2 == _root.head){ _loadedMC2._x = 0; _loadedMC2._y = 0; }else{ trace("I'm afraid _loadedMC2 didn't load, or is not defined!" + _loadedMC2); } }; var mcHead:MovieClipLoader = new MovieClipLoader(); mcHead.addListener(mc2Listener); mcHead.loadClip("SummaryHead.swf",this.head); //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //Loading the third container++++++++++++++++++++++++++++++++++++= this.createEmptyMovieClip("tabs", this.getNextHighestDepth()); var mc3Listener:Object = new Object(); mc3Listener.onLoadInit = function(_loadedMC3:MovieClip) { if (_loadedMC3 == _root.tabs){ _loadedMC3._x = 0; _loadedMC3._y = 514; }else{ trace("I'm afraid _loadedMC3 didn't load, or is not defined!" + _loadedMC3); } }; var mcTabs:MovieClipLoader = new MovieClipLoader(); mcTabs.addListener(mc3Listener); mcTabs.loadClip("TabControl.swf",this.tabs); //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //Loading the forth container++++++++++++++++++++++++++++++++++++= this.createEmptyMovieClip("nav", this.getNextHighestDepth()); var mc4Listener:Object = new Object(); mc4Listener.onLoadInit = function(_loadedMC4:MovieClip) { if (_loadedMC4 == _root.nav){ _loadedMC4._x = 300; _loadedMC4._y = 20; //_loadedMC4.swapDepths(_root.getNextHighestDepth()); }else{ trace("I'm afraid _loadedMC4 didn't load, or is not defined!" + _loadedMC4); } }; var mcNav:MovieClipLoader = new MovieClipLoader(); mcNav.addListener(mc4Listener); mcNav.loadClip("NavController.swf",this.nav);
Here is the code loaded from the nav container’s SWF:Code:Stage.align="TL"; _root.myXArray=(0, -34, -81, -128, -176, -162, -223, -273, -323); _root.myYArray=(150, -264);
Head carried no script.Code://This file loads to one of four containers on the main timeline. This file allows the user //to move the dataFile container holding the spreadsheet data rows. The onEnterFrame function // references a root an array on a file loaded to the dataFile container. Each time the user //click an arrow, the variable for array position changes the goalY or goalX variable on the main timeline. //These two variables control the scroll functionality for both the dataFile and the head containers. function slideY() { _root.dataFile.onEnterFrame = function() { _root.dataFile.diff = Math.abs(_root.dataFile._y-_root.goalY); if (_root.dataFile.diff<1) { _root.dataFile._y = _root.goalY; _root.head._y = _root.goalY; delete _root.dataFile.onEnterFrame; } else { _root.dataFile._y += (_root.goalY-_root.dataFile._y)*.3; _root.head._y += (_root.goalY-_root.head._y)*.3; } } }; function slideX() { _root.dataFile.onEnterFrame = function() { _root.dataFile.diff = Math.abs(_root.dataFile._x-_root.goalX); if (_root.dataFile.diff<1) { _root.dataFile._x = _root.goalX; _root.head._x = _root.goalX; delete _root.dataFile.onEnterFrame; } else { _root.dataFile._x += (_root.goalX-_root.dataFile._x)*.3; _root.head._x += (_root.goalX-_root.head._x)*.3; } } }; //These functions set the goal variables and activates scrolling (above) downM.onRelease = function() { _root.myYArray[i++]; _root.goalY = myYArray; slideY(); }; upM.onRelease = function(){ _root.myYArray[i--]; _root.goalY = myYArray; slideY(); }; rightM.onRelease = function() { _root.goalX = _root.myXArray[u++]; slideX(); }; leftM.onRelease = function(){ _root.goalX = _root.myXArray[u--]; slideX(); }; //These functions animate the arrows to give the user notice of function //I initially nested this code with the arrows symbol, but there was some //conflict preventing that from working. Instead of figuring it out, just moved //them to this timeline. The negative: 8 functions instead of 2. The positive: this works. leftM.onRollOver=function(){ leftM.play(); } leftM.onRollOut=function(){ leftM.gotoAndStop("home"); } rightM.onRollOver=function(){ rightM.play(); } rightM.onRollOut=function(){ rightM.gotoAndStop("home"); } upM.onRollOver=function(){ upM.play(); } upM.onRollOut=function(){ upM.gotoAndStop("home"); } downM.onRollOver=function(){ downM.play(); } downM.onRollOut=function(){ downM.gotoAndStop("home"); }
I have attached the debug output after I’ve clicked on the buttons. Obviously, the containers do not move as intended. But why?




Reply With Quote