A Flash Developer Resource Site

Results 1 to 8 of 8

Thread: passing variables into gotoAndPlay

  1. #1
    Junior Member
    Join Date
    Nov 2001
    Posts
    27
    I have a drag and drop movie that i want to use to load one of four other movies. the movie would be defined using an array. The array variable is B.

    essentially, i want to run the line:

    _root.movieB.gotoAndPlay(2);

    where B would be either 0, 1, 2, or 3. however, B's value won't be passed into this line, therefore, I can't get the movie I want to load.

    I hope i've explained this well enough. I really hope someone has an answer for me.

    Thanks! -tim

  2. #2
    :: rolla :: bluedot's Avatar
    Join Date
    Mar 2001
    Location
    home
    Posts
    273
    in this case is "B" your variable? and do you want the drag or dropped movie to change this variable once dropped? im not sure i totally understood your question, but i just got done doing some variables, and i might be able to help.

    jake

  3. #3
    Junior Member
    Join Date
    Nov 2001
    Posts
    27

    variables

    thanks for responding so quickly.

    B is the variable in my array. It is changed elsewhere, before we even use the movie in question.

    So basically, user toggles B to either 0, 1, 2, or 3. then they go to use the drag and drop movie that is meant to take the user to the movie clip "movieB". (I have movie clips named movie0, movie1, movie2, and movie3.

    So, at first I think to myself, easy, i'll just say

    on (click) {
    _root.movie(B).gotoAndPlay (2);
    }

    But obviously that is the wrong syntax. I've tried a bunch of other ways to state that line, but none work.

    That's where I'm at now.

  4. #4
    Senior Member
    Join Date
    Nov 2001
    Posts
    667
    You could try:

    on (release) {
    _root["movie"+B].gotoAndPlay (2);
    }

  5. #5
    Junior Member
    Join Date
    Nov 2001
    Posts
    27

    result

    thanks for the suggestion. When I compile the movie, I get this output:


    Symbol=briefingPodMovie, Layer=buttons, Frame=1: Line 20: Expected a field name after '.' operator.
    _root.["briefing"+b].gotoAndStop(2);


    by the way, the name of my movie is actually called "briefing", not "movie". and my variable is lower-case "b". Sorry if this causes confusion.

    any other suggestions?

  6. #6
    Senior Member
    Join Date
    Nov 2001
    Posts
    667
    Theres no dot after _root if you use square brackets. Make:

    _root.["briefing"+b].gotoAndStop(2);

    into:

    _root["briefing"+b].gotoAndStop(2);

  7. #7
    Junior Member
    Join Date
    Nov 2001
    Posts
    27

    YES!!!

    You rule!!!

    is there a good online resource / glossary of proper syntax? that would have saved me a lot of time....

    thanks again!!!

  8. #8
    Senior Member
    Join Date
    Nov 2001
    Posts
    667
    I dont know of one. But if there is Id love to know about it.

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