A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Backwards Frame Navigation

  1. #1
    Junior Member
    Join Date
    Apr 2011
    Posts
    1

    Backwards Frame Navigation

    Hi there, I'm having trouble with frame navigation. I'm working on a project for a class, and I want to be able to basically move from one room of a house to another, and back again. The problem is that I can't get it to move backwards. I'm using CS5 and Action Script 3, and here is my code:

    function gotoInst(evt:Event):void {
    gotoAndStop("Inst");
    }
    function gotopg00(evt:Event):void {
    gotoAndStop("pg00");
    }
    function gotopg0(evt:Event):void {
    gotoAndStop("pg0");
    }
    function gotopg1(evt:Event):void {
    gotoAndStop("pg1");
    }
    function gotopg2(evt:Event):void {
    gotoAndStop("pg2");
    }


    Start_Button.addEventListener("click", gotoInst);
    About_Button.addEventListener("click", gotopg00);
    pg00_pg0.addEventListener("click", gotopg0);
    Inst_pg1.addEventListener("click", gotopg1);
    Pg1_Pg2.addEventListener("click", gotopg2);



    Frame 'pg0' goes to 'pg00', and then back to 'pg0'. 'pg0' also will go to 'Inst' then to 'pg1' then to 'pg2'. The problem is that 'pg0' will go to 'pg00' and 'Inst', but that is as far as it will work, so 'pg00' won't go back to 'pg0', nor will 'Inst' go to 'pg1' for some reason. This error also pops up every time I run it:
    "TypeError: Error #1009: Cannot access a property or method of a null object reference.
    at AnimatedStory_fla::MainTimeline/frame1()"


    I have it set up so each new place it navigates to is five frames long, with Stops, put on each one to prevent it from constantly moving. (# of starting frame), frame label, Button_Name | Button_Name:
    (1), pg0, Start_Button | About_Button
    (5), pg00, pg00_pg0
    (10), Inst, Inst_pg1
    (15), pg1, Pg1_Pg2
    (20), pg2,


    Ideally, I would like to keep all the code on one continuous layer that runs along the whole scene. I plan to have it so once you go past pg2, you will be able to branch out in multiple directions (like going off the main room into a room that goes 2 or 3 more rooms deeper) and still be able to just back up to the previous room.

    So can anyone help me figure out how to get this to work?

  2. #2
    Member
    Join Date
    Nov 2008
    Posts
    66
    If you could post the file you're working with, that would help alot.

  3. #3
    Formerly "MacMatix" MacPerson's Avatar
    Join Date
    Oct 2003
    Location
    Australia
    Posts
    388
    When U say "from room to room" do U mean "frame to frame", "scene to scene" or "swf to swf" ?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center