A Flash Developer Resource Site

Results 1 to 19 of 19

Thread: problem w/ targetting a mc in an array (cant find the level)

  1. #1

    problem w/ targetting a mc in an array (cant find the level)

    Firstly, thanks to the people that helped me out with this problem so far. It's really appreciated!

    My main movie is set up much like a praystation tutorial, it is an array that links clips together horizontally with buttons on top that jump/slide the movie back and forth. Within each mc that is loaded into the array, there's a few for the subsection.
    I have the subsection parts set up so when you hit the nav on the subsection, it loads a movie on top of the previous one (about_mc.swapdepths(mydepth++); within the MC (thats located within the main movie)


    on my main timeline I have a variable-
    _global.mydepth = 10;

    the first main button has this script-
    _level0.content_mc.section_0.sectioncontent_mc.abo ut_mc.swapDepths(mydepth);about_mc.gotoAndPlay(2);


    When I had everything on the 10th level, I could target each clip and from the main time line, but since now it is loading a new movie (++) above the top level, I cant figure out a way to target the clips. What I want to happen is have each subsection reset itself to the beginning when the user hits the top button that slides the array over to a new section.

    I have uploaded my current movies, maybe someone can help me out. It's for my portfolio.

    www.quintessence-media.com/main.html

    www.quintessence-media.com/topnavbar.fla
    www.quintessence-media.com/section_0.fla

    thanks in advance.

  2. #2
    re bump

  3. #3
    i am so bummed that my caveman brain cant figure this out.

  4. #4
    Back from Hiatus mouse111's Avatar
    Join Date
    Oct 2001
    Posts
    599
    drop this into the code for the MC

    Code:
    trace(targetPath(this));
    then run a test movie and copy the text in the Output movie

    thats the target path

  5. #5
    which MC?
    Ill just give it a few shots!

  6. #6
    actually, I had the target path correct- as it turns out (amazingly!!)

    _level0.content_mc.section_0.sectioncontent_mc

    problem is, I cant get this to work-
    _level0.content_mc.section_0.sectioncontent_mc.abo ut_mc.swapDepths(mydepth);about_mc.gotoAndPlay(2);

  7. #7
    Back from Hiatus mouse111's Avatar
    Join Date
    Oct 2001
    Posts
    599
    do you get some sort of error?

  8. #8
    no nothing,
    I assumed that since I was using (mydepth++) that it was loading the mcs into an increasingly higher level- , but when I put trace(this) in a bunch of buttons, its always the level 10

  9. #9
    Back from Hiatus mouse111's Avatar
    Join Date
    Oct 2001
    Posts
    599
    if you are tracing the target path, i dont think it is going to give you the depth, just the path to the movie clip...although i have not tried it with an array so i dont know

  10. #10
    yeah, It doesnt trace the level, that's the problem .

  11. #11
    Back from Hiatus mouse111's Avatar
    Join Date
    Oct 2001
    Posts
    599
    yes....but the way to tell....would more than one part of the array be on the screen at the same time?

  12. #12
    i think so- but I am not sure, because I am not very knowledgeable of actionscript...
    did you check out the source file-

  13. #13
    can anyone help? por favor!

  14. #14
    Back from Hiatus mouse111's Avatar
    Join Date
    Oct 2001
    Posts
    599
    didnt look at the source file yet

    i will do that now

  15. #15
    Back from Hiatus mouse111's Avatar
    Join Date
    Oct 2001
    Posts
    599
    i am pretty sure the target to a movie clip with the depth is

    ("mc_name", depth).whatever

    i think its either that or ["mc_name", depth].whatever

  16. #16
    I know how to target it if it is in a static level, but the thing is that the active movie is getting moved up to a new level on each click. So I need some variable, or loop that tracks it, and changes the target path dynamically. And I have NO idea how to do that, Im sure I could figure it out, but I dont know what the starting direction would be.

  17. #17
    Back from Hiatus mouse111's Avatar
    Join Date
    Oct 2001
    Posts
    599
    /this is not tested/

    just use a for statement

    for (i = 0, i<= the current level, i++){
    then when tracking your movie, you can use ("mc_name", i /*(depth)*/)
    }

    this is not proper code, but you can get the general idea from it

  18. #18
    im sort of lost here-
    what exactly does that do, if you can explain it ..

    would the first statement just go in the first frame of my main movie? or the actions on the button?

  19. #19
    Back from Hiatus mouse111's Avatar
    Join Date
    Oct 2001
    Posts
    599
    sorry for not explaining

    basically what a for statement does is it counts through a variable (in that case i)

    it is a loop, but can be used to count variables

    in your case, you are adding 1 depth to the movie clip

    the for statement will count through from whatever you start it at (in the example i = 0, it starts counting from 0), and will loop (adding 1 the variable i each time, because of i++) until it hits the i<=the current level (which reperesents the highest depth that you are at)

    in your MCs you are using the variable i to count for the depth, so in your for statement, you are not going to want to use i, because it will change your depths, so use a variable that is not being used....single letters are easiest to keep track of, but anything will work

    the for statement goes in the same actions panel as your depth statement that you want to track

    this will track your movie clip dynamically, because as your letter i is increased, so is the variable in the for statement, and you can just use the variable in your for statement as the depth part of the movie clip.

    if you need more help, or i didnt explain it well, then let me know

    Dan/M111

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