A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Targeting Loaded movies or movieclips with JavaScript?

  1. #1
    Junior Member
    Join Date
    Apr 2000
    Posts
    1

    Post

    So here I am thinking i'm so clever by being able to change variables from javascript in a movie using:

    movie.SetVariable("xxx",xxx);

    no problem, right?

    however, I can't seem to target movies that are loaded into the main movie (specified my embed)... or even movie clips for that matter.

    movie.SetVariable("/_level0/xxx",xxx);
    wont work.

    Anybody have any ideas?

    thanks.

  2. #2
    Junior Member
    Join Date
    Mar 2000
    Posts
    20

    Post

    You seem to be referencing the variable incorrectly. The syntax should look like such:

    movie.SetVariable("/:xxx",xxx);

    yours looked like this:

    movie.SetVariable("/_level0/xxx",xxx);

    I will explain a few small things about it. First, you can drop the '_level0/' part because using '/' refers to the same thing (the main movie timeline) by default. Second, when referencing a variable, you do the same as you would with a movie clip, except use a colon just before the variable name.

    If I wanted to reference the variable X in level 4 I would do this:

    movie.SetVariable("/_level4:xxx",xxx);

    I hope this helps ya out.
    patrick



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