dcsimg
A Flash Developer Resource Site

Results 1 to 15 of 15

Thread: _levelX targeting

  1. #1
    Junior Member
    Join Date
    Dec 2002
    Location
    quebec, canada
    Posts
    10

    _levelX targeting

    hello, I am new to this board :-)
    I have been learning basic action script this past week and have run into a problem that the "help" option does not provide info on.

    Basically I have a button that when I press it it will attatch a movie clip to a target movie clip that I called "loadTarget". I made all these conditons and everything and it worked fine even when I made a function applying it to many buttons for different things to attatch.

    My problem is this: I wanted to see if I can target this "loadTarget" clip if it was on the main timeline of a loaded movie, on another level, say lvl 2. I have a feeling that the problem is in targeting the movie clip instance.

    So I looked up targeting movie clips in the help and it says rather than typing the standard _root. to type in _level2. so that it can find the clip on level 2 relative to the main movie...

    But it wont attatch the clip! It still cannot find the "loadTarget" clip instance in the loaded movie...

    can anyone help me? thanks :-)
    Theres none so deaf as those who will not listen...

  2. #2
    Product Designer keyone.it's Avatar
    Join Date
    Aug 2001
    Location
    Rome, Italy.
    Posts
    1,625
    I must say I never, NEVER, use levels...
    I think it's because I tried once, a long time ago, and it gave me some problem, so I stopped forever....

    Do you feel you really need to use a different level? Can't you just use movieclips...? That will make it neater to use..
    Altruism does not exist. Sustainability must be made profitable.

  3. #3
    Junior Member
    Join Date
    Dec 2002
    Location
    quebec, canada
    Posts
    10
    I guess I could avoid layars, but I may want to have multiple layars at one point or another, and want my layars to communicate...

    I am sure there is a simple solution to my problem and I just havn't found it yet. I would still appreciate it if somone could help me out.

    Also, what method do you guys use to upload movies in your library onto a targeted clip? I have been using the attatch movie function. It helps because it creates a new instance name for the result for me to generally target... are there any other prefered methods to loading up movies?
    Theres none so deaf as those who will not listen...

  4. #4
    Young Senior Member mayhem_sci's Avatar
    Join Date
    Jun 2002
    Location
    Singapore
    Posts
    282
    you loadtarget is a movieclip right? you can see what it is called when you test the movie (with the loadtarget where it is supposed to be). all u have to do is click on debug->list objects. then you can look for your loadtarget and it will show you the absolute path of the object.

  5. #5
    Product Designer keyone.it's Avatar
    Join Date
    Aug 2001
    Location
    Rome, Italy.
    Posts
    1,625
    when you use the "loadMovie()" action, the label will remain the one of the target movie, because the target movie will be REPLACED by the loaded one.
    if you use this:
    Code:
    _root.myMC.loadMovie("myNewMC.swf");
    then you will use the following path to retrieve the movie:
    _root.myMC

    Hope this helps...!

    p.s.
    I've NEVER had the need to use levels....and it's 3 and a half years I work with Flash..
    Altruism does not exist. Sustainability must be made profitable.

  6. #6
    Junior Member
    Join Date
    Dec 2002
    Location
    quebec, canada
    Posts
    10
    thanks for the debug path tip :-)

    the _root. path wont work becaue its on another level, the _levelx path should be working to effectively replace the past _root path... I will check the debug>list objects to see if it gives a path relative to the first loaded movie.

    What if my movie target was within a movie loaded inside a movie clip, ie: I were to load a movie then loaded the taget movie inside that... I would assume that the _root method will work since it all belongs to the same flash presentation/web site. I can check this out for myself later..

    I seem to like the attatch movie clip better than the load movie, since it gives a new name to the result. So many different movies can give the same resulting instance name which makes it a bit easier to unload them.
    Theres none so deaf as those who will not listen...

  7. #7
    Mod cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,448
    Check my site:
    http://can_info_guide.tripod.com/
    Check the menu.
    There is a pathcorrector component for movies loaded into movieclips but follow instructions exactly.
    - The right of the People to create Flash movies shall not be infringed. -
    | www.Flashscript.biz | Flashscript Biz Classes/Components |

  8. #8
    Young Senior Member mayhem_sci's Avatar
    Join Date
    Jun 2002
    Location
    Singapore
    Posts
    282
    hopefully cancerinform's component can help u out. but you should still try to clarify all the targeting issues. just create simple testing movies and try things out yourself, that's the best way to learn. as for loadmovie, i always load it on a unique mc, usually by creating an empty clip first, so it will still have a name like attachmovie! another debugging technique i often use is to add a "trace(this._target)" on the timeline of movie clips.

  9. #9
    Junior Member
    Join Date
    Dec 2002
    Location
    quebec, canada
    Posts
    10
    well I tried what one of you suggested by loading the movie into a target clip, and it still can't find it even when I type the EXACT path the debugger says.

    heres what I did:
    Put MC on the presentation called its instance "target1"
    on frame 1,

    actions of frame one: load movie "something" target is _root.target1 I know it loads because I put a square in the loaded movie to visually show me the presance of the other movie.

    Within this loaded movie I put another empty movie clip called "loaderTarget" and its instance name is the same.

    now what I am doing with this setup is that I want to attatch a movie clip in my library to the "loaderTarget" clip using "attatch movie clip". Where it says "object" I type in the exact path the debugger gives: _root.target1.loaderTarget

    all this works if I were to have "loaderTarget" in the unloaded movie on the main timeline, or even if I put it inside another clip in the main movie. But when I put it inside a movie that was loaded, I can't target it...

    I have discovered this is not just a layars problem. Has anyone done this sort of thing? or encountered this problem??
    Theres none so deaf as those who will not listen...

  10. #10
    Young Senior Member mayhem_sci's Avatar
    Join Date
    Jun 2002
    Location
    Singapore
    Posts
    282
    can u post a simple eg fla of this? it's really confusing.

  11. #11
    Flash Video Moderator Wheels's Avatar
    Join Date
    Dec 2000
    Location
    Minneapolis
    Posts
    1,590
    There is nothing wrong with using levels, it's just a bit confusing - so some may give up a bit easier than you. You'll be cheating youself of some of the flexibility afforded by loadMovieNum() if you choose to ignore levels. Much like many methods in Flash, it is not the end all - do all, simply another tool in your holster.

    The only problem I've run into loading levels is that is can be difficult to pass the _level as a parameter when writing functions.

    The best description I have read on layers and levels is in Colin Moocks ActionScript Dictionary - but think of it this way:

    _level0 = the root of the main movie

    _level0._level1 is the path to your movie on level one from movies on other levels.

    _level1.movie_clip to a mc in the movie on level one.

    If you refrence _root from the movie on _level1, Flash thinks you mean the _root of _level1, in order to reach the _root of the main movie you target with _level0.

    One thing that people often confuse is the difference between levels and layers. When you use attachMovieClip() you must assign a level within the movie clip layer. You could assign 500 if you want, but load a movie to _level499 and it will still be above the main movie, and appear over your mc on layer 500 of the movie clip in your main movie.

    Confusing, yes - but with a bit of practice you will find more flexibilty (especially with dynamic content) using _levels.

  12. #12
    Senior Member
    Join Date
    Aug 2002
    Location
    Dublin, Ireland
    Posts
    1,749

    My tuppworth.

    I am sure there is a simple solution to my problem
    As you are using functions anyway:
    PHP Code:
    function dostuff mcpathfiletoload ) {
        
    // Whatever code you want, applied to the mcpath eg:
        
    mcpath.loadMoviefiletoload );

    You then send whatever path you want to the function for eg:
    PHP Code:
    // From a MC, loading in a sub MC
    this.createEmptyMovieClip"myMC");
    _root.dostuffthis.myMC"movie.swf" );
    // From the main timeline, load in _level2.mymc
    dostuff_level2.mymc"movie.swf" );
    // To overwrite the MC you are in
    _root.dostuffthis"movie.swf" ); 

  13. #13
    Junior Member
    Join Date
    Dec 2002
    Location
    quebec, canada
    Posts
    10

    targeting

    ok here are the files of what I want to do:

    loading-different-clips22.fla

    is the base movie. I made the function to load different movie clips in that movie. The intial conditions have some un-important variable set to flase (having to do with the actual loading of the mc's), then a movie loaded inside an empty movie clip at top left corner of stage.

    The movie that is loaded is called "loadertarget-movie.swf"
    within that movie is the empty movie clip with instance called "loaderTarget"

    My function attempts to target this empty clip and attatch a mc to it.
    I spoke to some other people about this problem. They said that it was some glitch in the program that could not be fixed. An inter-movie targeting problem, that no loaded movie can target something inside another loaded movie. I have tried everything I can, if anyone wants to take a look at the files they are more than welcomed :-)
    Attached Files Attached Files
    Theres none so deaf as those who will not listen...

  14. #14
    Junior Member
    Join Date
    Dec 2002
    Location
    quebec, canada
    Posts
    10
    heres the other one
    Attached Files Attached Files
    Theres none so deaf as those who will not listen...

  15. #15
    Young Senior Member mayhem_sci's Avatar
    Join Date
    Jun 2002
    Location
    Singapore
    Posts
    282
    here is my analysis:

    You CAN target loaderTarget from the clips22 file, but the mc (number 1 load) that you try to attach to it does not exist in the loadertarget file, which is why it will not work. if u put "number 1 load" into the loadertarget file, it will work. this makes sense, becos suppose what u have works: what if both movie contains something called "number 1 load", which file should flash attach? therefore while flash will allow u to control the loaded movie, it will not allow u to ADD symbols or things to it. you can control it, but only the things that it has originally. you can't add symbols to it run-time. so even if both movies have a linked symbol that has the same name, flash will load whichever depending on where u target.

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