dcsimg
A Flash Developer Resource Site

Results 1 to 8 of 8

Thread: _root in cs3

  1. #1
    Junior Member
    Join Date
    May 2007
    Location
    Montreal
    Posts
    3

    _root in cs3

    Hi,
    I have a movie clip with a button called test.
    I have the following code :

    -----------------------------------------------------------------
    function eventResponse(event:MouseEvent):void
    {
    _root.gotoAndPlay("organization");
    }

    test.addEventListener(MouseEvent.CLICK, eventResponse);
    ----------------------------------------------------------------

    I put the movie clip on my main scene(root)
    It doesn't work.
    What is the code that I need to put in my movieClip to access my main timeline.

    thanks

  2. #2
    half as fun, double the price senocular's Avatar
    Join Date
    Feb 2002
    Location
    San Francisco, CA (USA)
    Posts
    4,361
    no underscore in AS3, just "root"

  3. #3
    Member
    Join Date
    Jun 2007
    Posts
    47
    root doesn't work.

  4. #4
    Mod cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,448
    Try gotoAndPlay("organization"); or try event.parent.gotoAndPlay("organization");

    Edited: event.target.parent.gotoAndPlay("organization"); (of course)
    Last edited by cancerinform; 06-06-2007 at 08:40 AM.
    - The right of the People to create Flash movies shall not be infringed. -
    | www.Flashscript.biz | Flashscript Biz Classes/Components |

  5. #5
    Member
    Join Date
    Jun 2007
    Posts
    47

    Angry

    still dont work!

  6. #6
    Member
    Join Date
    Oct 2000
    Posts
    93
    FYI - A DisplayObjects reference to root is null until its added to the display list. Try using trace statements to diagnose your problem.

    Also, your could try event.target.parent or event.target.root and see if that helps.

    PHP Code:
    event.target.root.gotoAndPlay"organization" ); 
    Last edited by jjcorreia; 06-05-2007 at 11:38 PM.

  7. #7
    Member
    Join Date
    Jun 2007
    Posts
    47

    Talking

    thanks a lot!

  8. #8
    Junior Member
    Join Date
    May 2007
    Location
    Montreal
    Posts
    3
    Ok guy I figured out what is the clean way now in cs3 here's the code :

    In the movieClip :

    stop();

    var m:MovieClip;

    function setParentobject(p:MovieClip)
    {
    m = p;
    }

    function gotoOverview(event:MouseEvent):void
    {
    m.gotoAndPlay("organization")
    this.visible = false;
    }

    overview.addEventListener(MouseEvent.CLICK, gotoOverview);


    Root timeLine :

    subReports.setParentobject(this);

    I hope this will help

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