A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: _.root.VARIABLE._alpha = 10???????

  1. #1
    Angkor-What? Gekke_Hollander's Avatar
    Join Date
    Jun 2000
    Location
    Netherlands
    Posts
    234

    _.root.VARIABLE._alpha = 10???????

    Hi,

    I'm trying to following:

    i = 5;
    _root."px"+(i-1).canvas._alpha = 50;

    So what I want to do is call the movieclip canvas inside movieclip px4 on the root and set it's alpha to 50...

    I've tried lots:

    _root.eval("px"+(i-1)).canvas._alpha = 50;
    but this looks for the variable stored in px4

    _root.+("px"+(i-1))+.canvas._alpha = 50;
    isn't allowed

    _root.("px"+(i-1)).canvas._alpha = 50;
    isn't allowed

    What is the correct syntax to do this?

    Cheers,
    Gekke_Hollander
    MX 2004 Pro - Oops I did it again!!!
    SWF, it's a journey... not a destination

  2. #2
    Random without a cause Bartsje's Avatar
    Join Date
    Apr 2003
    Location
    Lalaland
    Posts
    193
    So you're trying to dynamically call a target path right? The right way to do this i think is like this:

    eval("_root.px"+variable).canvas._alpha = 50;

    Hope this works and helps you out.

    Greetz

    Bart

  3. #3
    Angkor-What? Gekke_Hollander's Avatar
    Join Date
    Jun 2000
    Location
    Netherlands
    Posts
    234

    thanx

    While you were posting I finally found it:

    eval("_root.px" + (name-1) + ".canvas")._alpha = 50;

    Thanx mate,

    Gekke_Hollander
    MX 2004 Pro - Oops I did it again!!!
    SWF, it's a journey... not a destination

  4. #4
    Random without a cause Bartsje's Avatar
    Join Date
    Apr 2003
    Location
    Lalaland
    Posts
    193
    Ooops, nope, the canvas part also needs to be between the eval brackets i think, so it's like this:

    eval("_root.px"+variable+".canvas)._alpha = 50;

    Sorry

    Greetz

  5. #5
    Random without a cause Bartsje's Avatar
    Join Date
    Apr 2003
    Location
    Lalaland
    Posts
    193
    Ok, sloth is my major sin i admit

    Greetz, succes

  6. #6
    Member
    Join Date
    May 2003
    Location
    sky
    Posts
    38
    and array access [] will also be in handy.

    Regards~
    wanna fly in the sky~

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