A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: Target paths and loadMovie

Hybrid View

  1. #1
    Senior Member
    Join Date
    Jul 2006
    Posts
    104

    Target paths and loadMovie

    i was wondering if there is a way to reference the main timeline of a swf that is loaded into another swf with loadMovie--but keep the actionscript functionality of the loaded swf when editing individually.

    I know, confusing..but i will try to make it as clear as possible.

    I will refer to the main swf that is loading the other swf as main.swf and the swf being loaded as loaded.swf

    when i refer to the main timeline in loaded.swf i use _root but the problem is when i load loadedswf into main.swf (using loadMovie) Flash thinks (by using _root in loaded.swf to reference its main timeline) i mean to reference the main timeline of main.swf--which is not what i want.

    so, my question is: is there a way to reference ONLY the main timeline of loaded.swf? (somehow a more specific target path to only loadedswf's main timeline)

    (the reason being when i edit loadedswf.fla none of the functionality works if i have to change the target paths to account for the root timeline and the movieclip in main.swf)

    if you need me to clarify anything feel free to ask


    Thanks,

    Lex
    Last edited by Lexthayn; 03-08-2007 at 12:46 PM.

  2. #2
    FK'n_dog a_modified_dog's Avatar
    Join Date
    Apr 2003
    Location
    "aaarf"
    Posts
    9,176
    try using _lockroot = true; on frame#1 in loaded.swf
    any code in loaded.swf that uses syntax _root
    will now look to loaded.swf main timeline,

    hth

  3. #3
    Senior Member
    Join Date
    Jul 2006
    Posts
    104
    wahoo! you just made my hour. thank you. you rock.

  4. #4
    Registered User nunomira's Avatar
    Join Date
    May 2002
    Location
    portugal
    Posts
    7,003
    hi,

    Using _lockroot is a workaround... not considered exactly a good practice. The same goes for _root.
    Don't use _root, use relative paths instead (for your next projects at least )

  5. #5
    Senior Member
    Join Date
    Jul 2006
    Posts
    104
    how would you reference a root timeline relatively?

    because _lockroot works great. the only problem is one aspect of the functionality uses _root._xmouse, root._ymouse and that poses a problem when _lockroot is true.

    so if there is a way to have a relative target path to the main timeline. that would be swell.

    Lex

  6. #6
    Registered User nunomira's Avatar
    Join Date
    May 2002
    Location
    portugal
    Posts
    7,003
    how would you reference a root timeline relatively?
    That depends on where the code is attached.
    But using relative paths means that you don't use _root. It also means that you'll use this and or _parent (or a combination of both / each).

    Read understanding target paths for more details.

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