Jump to content
Search Community

Can I play a TimeLineMax on main time line out of the loaded SWF file?

ngrinchenko test
Moderator Tag

Recommended Posts

My main time line is sectioned into two labeled keyframed sections.

In section1 I have a button called "APPLICATIONS" which colors blue on roll over and discolors on roll out.

In this section1 there is an SWF loader which loads additional buttons. These buttons when clicked bring user to section2, where the button "APPLICATIONS" should be staying colored in. However it does not happen.

My idea was to play the timeLine which is set up is section1 in the main file by a command in the loaded SWF file, but it doesn't seem to work out.

Is it possible to accomplish?

Link to comment
Share on other sites

the problem is once you gotoAndPlay("section2") your TimelineMax is no longer accessible from the child swf.

 

bad:

 

function green_PopUp(event:MouseEvent): void { 
MovieClip(parent.parent.parent).gotoAndPlay("section2");
MovieClip(parent.parent.parent).Applications_btn_timeLine.play();
}

 

the solution is to target the TimelineMax BEFORE going to section2

 

 

function green_PopUp(event:MouseEvent): void { 
MovieClip(parent.parent.parent).Applications_btn_timeLine.play();
MovieClip(parent.parent.parent).gotoAndPlay("section2");
}

 

switching those 2 commands prevented the error from happening and the timeline appeared to play (text turned blue).

 

I found this a little surprising as I would have expected the timeline to still be accessible from all frames. Again, when you jump from frame to frame these are the types of errors that you will encounter.

 

Instead of going to frame ("section2") you would be better off doing something like this in frame 1 (with all assets in frame 1

 

function goSection2(){
  section1_mc.visible = false;
  section2_mc.visible = true;
}

 

Obviously that is a bit simplified but it seems the only reason you are using multiple frames is to show and hide various elements. Using a single frame approach allows you to have all your code and assets in one place and you get relieved of all of these "variable scope" issues.

Link to comment
Share on other sites

Wow, This is a new approach to me. I have a fairly complicated website. The reason I segmented the main time line is that I can easily see each labeled section and access a code for it right away.

What you are suggesting, if understand you correctly, the entire site consists of only one frame with Movie Clips for each section located on that frame.

Then all the code per each section would be located? Is it inside the Movie Clip for each section or on one layer of the first frame where all of the movie clips for the website are located?

If I put the code on first frame for all the present movie clips - it will become one huge page of code for everything. Is it how it is done? Or only navigation goes on first frame and all the rest as animation goes inside the movie clips?

I would appreciate if you could drop a note on that subject and perhaps point me to a good follow up tutorial on this?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...