SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Jul 2002
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Using gotoAndPlay with a variable for the scene name

    Hi all,

    Trying to write what I thought would be a simple function for moving around within a multiple scene movie. Basically, this is the function:

    Code:
    function gotoNextScene(pauseDuration, loopScene, loopFrame, targetScene, targetFrame) {
     if (startTime == null) {
      startTime = getTimer();
      gotoAndPlay(loopScene, loopFrame);
     } else {
      lapsedTime = getTimer()-startTime;
      if (lapsedTime>pauseDuration) {
       gotoAndPlay(targetScene, targetFrame);
      } else {
       gotoAndPlay(loopScene, loopFrame);
      }
     }
    }
    I want to be able to call the function and pass it the 5 parameters in a bunch of places throughout the movie. The problem is that MX wants the scene parameter of gotoAndPlay to be in quotes. Of course, if I put it in quotes, it gets interpreted literally.

    Is there any way to acheive this without writing 10 lines of code everywhere I want to do this within the movie? Thanks for your help!

  2. #2
    SitePoint Member
    Join Date
    May 2003
    Location
    uk
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    instead of a scene name and frame number you can just use a frame label on the desired frame, frame labels can be targeted regardless of which scene you are currently in.


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
  •