A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: How to write a gotoAndPlay with the addition of a variable

  1. #1
    Junior Member
    Join Date
    Mar 2006
    Posts
    28

    How to write a gotoAndPlay with the addition of a variable

    So I've defined my variable:

    _global.current = 1;

    And below i am accessing an MC called 'carousel_holder', which has an MC named 'bar' and inside this MC is a final MC named 'bar1'.

    So ive tested my path and can hard code it fine, so its not a paths issue but i think my syntax is incorrect:

    _root.carousel_holder+".bar"+current.gotoAndPlay(" start");


    Thanks in advance.

  2. #2
    Senior Member
    Join Date
    Jun 2008
    Posts
    549
    Try this

    Code:
    carousel_holder.bar.bar1.gotoAndPlay(" start");

  3. #3
    Junior Member
    Join Date
    Mar 2006
    Posts
    28
    Hi ilike2,

    Thanks for your reply, If i hard-code it as you suggest it works fine, but it needs to include the variable and the string as below:

    _global.woteva = 1;

    _root.carousel_holder+".bar"+woteva.gotoAndPlay(" start");


    Thanks,
    Ben.

  4. #4
    Junior Member
    Join Date
    Mar 2006
    Posts
    28
    so that the actual path its going to is:

    _root.carousel_holder.bar1.gotoAndPlay("start");

  5. #5
    Junior Member
    Join Date
    Mar 2006
    Posts
    28
    fixed it:

    _root.carousel_holder[woteva].gotoAndPlay("start");

    Cheers,
    Ben.

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