A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: How can I call funtions on the main timeline, from a different time line

  1. #1
    Junior Member
    Join Date
    Aug 2008
    Location
    Canada
    Posts
    20

    How can I call funtions on the main timeline, from a different time line

    so here's the function on main stage:

    function slideImage(btnNum:Number)
    {
    trace("scrolling image");
    trace(btnNum);

    var myTween2:Tween = new Tween(imageObjects, "x", Strong.easeOut, imageObjects.x, imageObjects.x - 600, 1.5, true);
    }


    and here's the code that wants to call this function in a another movie clip. I've attached this clip dynamicaly to the main stage as well.

    var btnNumber;

    this.addEventListener(MouseEvent.CLICK, gotoLink);

    function gotoLink(event:MouseEvent)
    {
    trace(btnNumber);
    slideImage(btnNumber);
    }


    How can i acess slideImage function on the main stage. in AS2 _root.slideImage(btnNumber); would work. How Would I do this in AS3?

    Apreciate your help. Thank you.

  2. #2
    Moderator enpstudios's Avatar
    Join Date
    Jun 2001
    Location
    Tampa, Fl.
    Posts
    11,282
    Look into Global Functions, they are accessible from all timelines.

  3. #3
    Junior Member
    Join Date
    Aug 2008
    Location
    Canada
    Posts
    20
    I got it working, Thanks

  4. #4
    Moderator enpstudios's Avatar
    Join Date
    Jun 2001
    Location
    Tampa, Fl.
    Posts
    11,282
    Good Deal

Tags for this Thread

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