Navigation Issues

  • nornholdj
  • Novice
  • Novice
  • User avatar
  • Posts: 18

Post 3+ Months Ago

Hi Everyone,

I am fairly new to Flash but I have a decent amount of experience in other languages (C++, C#, ect.) so I can understand most of the Actionscript in posts. I am using AS 3.0 and the CS3 version of Flash.

My current project that I'm working on is basically a full website made from a single Flash movie. I have MCs inside of MCs and basically my question is: Is there anyway that I can create an onClick event that will go to one frame in say my root movie then go to frame in a movie that is on that frame? The sub-MC only exists in that frame of the parent MC.

For example (in psuedocode):
Code: [ Select ]
root.gotoAndStop("frameWithSubMC");
subMC.gotoAndStop("targetFrame");
  1. root.gotoAndStop("frameWithSubMC");
  2. subMC.gotoAndStop("targetFrame");


Is that possible to do in the same frame?

Reasoning:
I have a basic menu in my root timeline that controls all user navigation. On another "page" (so to say, technically another frame), I have a MC that is a tab-like application(a series of tabs that display different info depending on which one is selected). I'd like to be able to send a user to a specific tab from the menu.

Thanks,

-Jordan


P.S. - I've been looking over this site for the last few days and I must say this is quite a nice site.
  • ATNO/TW
  • Super Moderator
  • Super Moderator
  • User avatar
  • Posts: 23455
  • Loc: Woodbridge VA

Post 3+ Months Ago

This post contains a reply that might be close to what you want.
http://board.flashkit.com/board/showthread.php?t=444666

Scroll a few replies down for the one from pellepiano.
Quote:
This information had been useful to know.

Then each button sets a framelabel variable, ex

// Load action and this
_level0.whereToGo="galleryLabel";

and in the external swf beginning

gotoAndPlay(_level0.whereToGo);
  • nornholdj
  • Novice
  • Novice
  • User avatar
  • Posts: 18

Post 3+ Months Ago

Thanks for the quick reply.

When I try that I get the error: 1120: Access of undefined property _level0 - gotoAndPlay(_level0.whereToGo);


This is on the first frame of th sub-movie. Its like the value isn't being passed.

I have this in the main movie time line (in an on click event listener):
Code: [ Select ]
 
_level0.whereToGo = "tab0";
gotoAndPlay(_level0.whereToGo);
 
  1.  
  2. _level0.whereToGo = "tab0";
  3. gotoAndPlay(_level0.whereToGo);
  4.  


and I have this in the first frame of the sub-movie:
Code: [ Select ]
gotoAndPlay(_level0.whereToGo);



I'm not sure what I'm doing wrong This is a movie clip symbol not an external movie clip so I'm not doing any loading or anything like in that post you gave me.

Thanks,

-Jordan
  • graphixboy
  • Control + Z
  • Mastermind
  • User avatar
  • Posts: 1828
  • Loc: In the Great White North

Post 3+ Months Ago

I think the problem is that your sub movie clip doesn't exist on the frame where the actionscript calls a change. Imagine that the frames in Flash are like multiple separate html files. If you try to use script to access content in PageB.html from PageA.html you'll have some issues because your scripts in PageA won't be able to find the items in PageB (the itmes exist but not in the same context).

I've found that flash has lots of problems if you try to modify something that doesn't exist until later on the timeline. You have a few options. First you can make your timeline one frame and turn things on or off at the proper times. This is probably a better option since things will exist automatically when you need them.

The second option is to attach the clip to the stage from the library before you call it. This at least means that the code will have some sort of variable available to track the addition and then be able to find the clip later to modify it.
  • nornholdj
  • Novice
  • Novice
  • User avatar
  • Posts: 18

Post 3+ Months Ago

Alright, that makes sense. I'm working on converting my main timeline to one frame and then having all of my different content pages in a movie clip. I'll let you know if I have anymore issues.

Thanks for your help guys.

-Jordan
  • nornholdj
  • Novice
  • Novice
  • User avatar
  • Posts: 18

Post 3+ Months Ago

Ok, so ... this, to me, should work. This is in my dedicated actions layer on the first and only frame of my main timeline and this is the only code that I have there.
Code: [ Select ]
 
services.sMenu.silverPlan.addEventListener(MouseEvent.CLICK, gotoTab0);
 
function gotoTab0(myEvent:MouseEvent):void
{
    pageContent.gotoAndStop("tab0");
}
 
stop();
 
  1.  
  2. services.sMenu.silverPlan.addEventListener(MouseEvent.CLICK, gotoTab0);
  3.  
  4. function gotoTab0(myEvent:MouseEvent):void
  5. {
  6.     pageContent.gotoAndStop("tab0");
  7. }
  8.  
  9. stop();
  10.  

services is a movie clip that is my menu, sMenu is a movie clip inside services that I use for animations, and silverPlan is a button inside of sMenu. pageContent is my content movie clip that contains all of my detail "pages". Finally, tab0 is the frame label for the desired frame.

When I run this, I get no compilation errors or runtime errors, but when I click on it nothing happens.

Am I doing something obscenely wrong?

I'm thinking that this is the line where I'm messing up. I don't think I'm accessing the object correctly (i.e. - the "services.sMenu.silverPlan" part).
Code: [ Select ]
services.sMenu.silverPlan.addEventListener(MouseEvent.CLICK, gotoTab0);



Thanks,

-Jordan
  • graphixboy
  • Control + Z
  • Mastermind
  • User avatar
  • Posts: 1828
  • Loc: In the Great White North

Post 3+ Months Ago

my gut says its a path issue... did you try putting a trace inside the function to see if the function actually runs?
  • nornholdj
  • Novice
  • Novice
  • User avatar
  • Posts: 18

Post 3+ Months Ago

I did now. I put a breakpoint on the goto line inside the function and it never gets called when I click on it. I added another breakpoint to make sure the handler was getting added, and that works, but it seems like it never realizes that I click on the button. I guess it does explain why I wasn't getting any errors though. I'm not sure why it's not triggering the event though.

Post Information

  • Total Posts in this topic: 8 posts
  • Users browsing this forum: No registered users and 19 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.