Skip to main content
Known Participant
August 12, 2012
Answered

getFrame function

  • August 12, 2012
  • 1 reply
  • 806 views

I've been working on a tutorial to teach myself the basics of building Flash websites. Unfortunately, I've run into a problem and the tutorial's author is apparently not taking questions any more. I don't want to just scrap the whole thing, because I've put a lot of time into it. So if anyone could help me figure out the problem I'd be super grateful.

Basically I have a menu that is centered on the home page but flies to the top right corner when on any other page. But when I try to click on the navigation to go to any of the other pages, I get this error:

TypeError: Error #1006: getFrame is not a function.

    at PortfolioSite2012_fla::MainTimeline/navigationClicked()

If getFrame isn't a function, then why does it work for the tutorial's author in the source files that he allows you to download? I'd love an explanation along with the answer, if that's possible, so I can understand and learn from this.

Here's the link to the tutorial if you want to see it http://www.webdesigndev.com/flash/creating-a-flash-portfolio-website/comment-page-2#comments. Except I am working in CS5, not CS3.

And here's my code for the website.

/////////////////////////////////////////////////////////////////////

// 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(MouseEvent.CLICK, navigationClicked);

mainMenu_mc.resume_btn.addEventListener(MouseEvent.CLICK, navigationClicked);

mainMenu_mc.contact_btn.addEventListener(MouseEvent.CLICK, navigationClicked);

mainMenu_mc.portfolio_btn.addEventListener(MouseEvent.CLICK, navigationClicked);

mainMenu_mc.photography_btn.addEventListener(MouseEvent.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.photography_btn :

            frmLabel = "photography_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);

    }

}

Thanks so much for any help!

This topic has been closed for replies.
Correct answer Ned Murphy

For what you show, you appear to be missing a bit of code from the main timeline of the fla file, which includes the getFrame function your code is looking for.  Try looking at the source file provided that you downloaded - that function is not hard to find.

1 reply

Ned Murphy
Ned MurphyCorrect answer
Legend
August 12, 2012

For what you show, you appear to be missing a bit of code from the main timeline of the fla file, which includes the getFrame function your code is looking for.  Try looking at the source file provided that you downloaded - that function is not hard to find.

s_huckinsAuthor
Known Participant
August 14, 2012

Ahh, now I see. I didn't realize the function had to be written and I somehow I missed that step. Thanks so very much

Ned Murphy
Legend
August 14, 2012

You're welcome.

Generally, if your code uses built-in functions or properties, you will see that code in blue in the Actions panel.  If you see it in black, then chances are it is a custom bit of code that needs to be defined somewhere within the code itself.