PDA

View Full Version : TypeError #1010:= me losing my hair.


Troycus
06-03-2011, 03:35 AM
I can't seem to find the error after debugging my movie. I get this:

TypeError: Error #1010: A term is undefined and has no properties.
at twilliams_fla::MainTimeline/frame1()[twilliams_fla.MainTimeline::frame1:21]

Here is the code:

/////////////////////////////////////////////////////////////////////
// Includes and Imports.
/////////////////////////////////////////////////////////////////////
import utils.Fader;

/////////////////////////////////////////////////////////////////////
// Startup.
/////////////////////////////////////////////////////////////////////
stop();
mainMenu_mc.stop();


/////////////////////////////////////////////////////////////////////
// Event Setup.
/////////////////////////////////////////////////////////////////////
backward_btn.addEventListener(MouseEvent.CLICK, navigationClicked)
forward_btn.addEventListener(MouseEvent.CLICK, navigationClicked);
logo_btn.addEventListener(MouseEvent.CLICK, navigationClicked);
home_btn.addEventListener(MouseEvent.CLICK, navigationClicked);
mainMenu_mc.profile_btn.addEventListener(MouseEven t.CLICK, navigationClicked);
mainMenu_mc.resume_btn.addEventListener(MouseEvent .CLICK, navigationClicked);
mainMenu_mc.contact_btn.addEventListener(MouseEven t.CLICK, navigationClicked);
mainMenu_mc.portfolio_btn.addEventListener(MouseEv ent.CLICK, navigationClicked);
mainMenu_mc.respect_btn.addEventListener(MouseEven t.CLICK, navigationClicked);

/////////////////////////////////////////////////////////////////////
// Event Handlers.
/////////////////////////////////////////////////////////////////////
function navigationClicked(Event:MouseEvent):void
{
//We'll use this to store the Frame Label's name.
var frmLabel:String = '';

//Determine what Frame Label to use based on which
//button was clicked.
switch (Event.target)
{
case backward_btn :
frmLabel = this.getSequencedFrame(false);
break;
case forward_btn :
frmLabel = this.getSequencedFrame(true);
break;
case logo_btn :
frmLabel = "home_frm";
break;
case home_btn :
frmLabel = "home_frm";
break;
case mainMenu_mc.profile_btn :
frmLabel = "profile_frm";
break;
case mainMenu_mc.resume_btn :
frmLabel = "resume_frm";
break;
case mainMenu_mc.contact_btn :
frmLabel = "contact_frm";
break;
case mainMenu_mc.portfolio_btn :
frmLabel = "portfolio_frm";
break;
case mainMenu_mc.respect_btn :
frmLabel = "respect_frm";
break;
}

//Find the frame number based on our Frame Label.
var frmGoto:Number = this.getFrame(frmLabel);

//Don't do anything if we are already on the requested page.
if (currentFrame != frmGoto)
{
//Get and remember the Home page's frame number.
var frmHome:Number = this.getFrame("home_frm");

//If our requested page is the Home page, the flying menu
//needs to go home.
if(frmGoto == frmHome)
{
mainMenu_mc.goHome();
}
//Else, if we are on the Home page and are leaving, then
//leave home.
else if(currentFrame == frmHome)
{
mainMenu_mc.leaveHome();
}

//Go to the requested page.
gotoAndPlay(frmGoto);
}
}

/////////////////////////////////////////////////////////////////////
// Helper Functions.
/////////////////////////////////////////////////////////////////////
function getFrame(frameName:String):Number
{
var frame:Number = 1;

//Loop through all Frame Labels to find our requested frame.
for (var i = 0; i < currentLabels.length; i++)
{
if (currentLabels[i].name == frameName)
{
frame = currentLabels[i].frame;
break;
}
}

return frame;
}

function getFrameLabel(frame:Number):String
{
var frmLabel:String = '';

//Loop through all Frame Labels to find the requested Frame Label.
for (var i = 0; i < currentLabels.length; i++)
{
if (currentLabels[i].frame == frame)
{
frmLabel = currentLabels[i].name;
break;
}
}

return frmLabel;
}

function getSequencedFrame(forward:Boolean):String
{
//Used to remember the Frame Label of our page.
var frmSequence:String = '';

//If we're looking for the next page in sequence...
if(forward)
{
//If our current page is that last page...
if(currentFrame == this.getFrame("respect_frm"))
{
//...then, we need to go Home.
frmSequence = "home_frm";
}
else
{
//...else, we just need to go to the next frame.
frmSequence = this.getFrameLabel((currentFrame + 1));
}
}
//...else, we're looking for the previous page in sequence.
else
{
//If we're on the first page (remember, we skipped our Start page)...
if(currentFrame == this.getFrame("home_frm") ||
currentFrame == this.getFrame("start_frm"))
{
//...then, we need to go to the last page.
frmSequence = "respect_frm";
}
else
{
//...else, we just need to go to the the previous frame.
frmSequence = this.getFrameLabel((currentFrame - 1));
}
}

return frmSequence;
}



Who wants to be the first to help me keep my hair ;-) Any help would be greatly appreciated.

akuji36
08-19-2011, 06:18 PM
Hello

try using the trace statement. It will output undefined for your variables giving problems