Flash Advisor logo
:: Desktop Shortcut
:: Flash Help
Advice from Experts

Closed Thread
Results 1 to 6 of 6
  1. #1

    Default Navigation With _root

    Hi!

    This is my first post in this forum. Lots of nice posts.

    I have the following problems.

    I want to create a website. I want when some of the menu/Button is pressed and before the user goes to the requested page there should be a transition between the pages/scenes. I have created 1 transition that i want it to be used for all the pages.
    But i have no clue how to do this. I have ssen some scripts that uses _root. But i have no idea how to do this and have read about _root, but still don't get it.

    Can someone please help me?

  2. # ADS
    Join Date
    Always
    Posts
    Many
     
  3. #2

    Default

    Could you send your fla? And which version of flash do you use?

  4. #3

    Default here

    OK here is the example flash i made.
    I have 3 buttons. each button i want to be linked to 3 pages. The pages are under the movie called pages.
    The transition (animation) is under the movie animation.
    Never minde the movie Devide.
    So when the buttons clicked i want to show the animation as the transition then i want it to jump to the page.
    Button 1 = Page 1 (p1)
    Button 2 = Page 2 (p2)
    Button 3 = Page 3 (p3)


    The Fla is at: www.secretsoflove.se/test.fla

  5. #4
    Join Date
    May 2004
    Location
    U.S.A.
    Posts
    2,890

    Default

    Hi,

    I took a quick look at your file. When you create a movieclip or button, give it an instance name so it can be identified with Actionscript. This allows you to use frame code instead of object code. A quick fix for your demo...

    Inside the transition movieclip, change the stop action from the last frame to the first frame.

    Give the transition movieclip an instance name.

    Give the buttons instance names.

    First frame of main timeline...

    Code:
    myButton1.onRelease=function(){
    	transitionMC.play();
    }
    myButton2.onRelease=function(){
    	transitionMC.play();
    }
    myButton3.onRelease=function(){
    	transitionMC.play();
    }
    The above individual button code optimized with a for loop...

    Code:
    for &#40;i=0; i<4; i++&#41; &#123;
    	_root&#91;"myButton"+i&#93;.onRelease = function&#40;&#41; &#123;
    		transitionMC.play&#40;&#41;;
    	&#125;
    &#125;
    hope it helps
    A mind once stretched by a new idea never regains its original dimensions.
    - Oliver Wendell Holmes

  6. #5

    Default thx

    ok thx! The transision script work, but it does not jump to any page!
    Should it not be a script at the end of the animation?

  7. #6
    Join Date
    May 2004
    Location
    U.S.A.
    Posts
    2,890

    Default

    Hi,

    The code doesn't account for pages, it is only telling the transition clip to play. You need to add a variable to control the "pages" movieclip from the transition or simply tell it to go to the appropriate frame from the button...

    Code:
    myButton1.onRelease=function&#40;&#41;&#123; 
       transitionMC.play&#40;&#41;;
       pagesMC.gotoAndStop&#40;1&#41;; 
    &#125; 
    myButton2.onRelease=function&#40;&#41;&#123; 
       transitionMC.play&#40;&#41;; 
       pagesMC.gotoAndStop&#40;2&#41;; 
    &#125; 
    myButton3.onRelease=function&#40;&#41;&#123; 
       transitionMC.play&#40;&#41;; 
       pagesMC.gotoAndStop&#40;3&#41;; 
    &#125;
    If you want the transition to control the pages movieclip, you can create a variable to hold the page value...

    currentPage=1;

    ... in the transition movieclip, you would need an if statement on a keyframe to check the variable and determine what to do...

    Code:
    stop&#40;&#41;;
    if&#40;currentPage==1&#41;&#123;
    pagesMC.gotoAndStop&#40;currentPage&#41;;
    &#125;else if&#40;currentPage==2&#41;&#123;
    pagesMC.gotoAndStop&#40;currentPage&#41;;
    &#125;
    play&#40;&#41;;
    You would set the variable from the button code...

    Code:
    myButton1.onRelease=function&#40;&#41;&#123; 
       currentPage=1;
       transitionMC.play&#40;&#41;; 
    &#125; 
    myButton2.onRelease=function&#40;&#41;&#123; 
       currentPage=2;
       transitionMC.play&#40;&#41;; 
    &#125; 
    myButton3.onRelease=function&#40;&#41;&#123; 
       currentPage=3;
       transitionMC.play&#40;&#41;; 
    &#125;
    hope it helps
    A mind once stretched by a new idea never regains its original dimensions.
    - Oliver Wendell Holmes

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Similar Threads

  1. _root. Absolute path won't work.
    By Shadar Logoth in forum Advanced Flash
    Replies: 4
    Last Post: 10-30-2006, 06:58 PM
  2. Controlling _root with a movieclip event
    By Allwyn in forum Flash Scripting
    Replies: 2
    Last Post: 05-28-2005, 06:40 PM
  3. Control _root from movie
    By Simon in forum Newbies
    Replies: 2
    Last Post: 04-06-2005, 09:06 AM
  4. Navigation help
    By Hishimoto in forum Flash Scripting
    Replies: 6
    Last Post: 09-16-2004, 11:54 PM
  5. _root -against- _parent?
    By fino in forum Flash Scripting
    Replies: 3
    Last Post: 08-12-2004, 06:06 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Sponsors
Create Speaking Characters for your website and Flash movies. 15 Day Free Trial