A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: [RESOLVED] finding a relative path

  1. #1
    Member
    Join Date
    Jul 2008
    Posts
    40

    resolved [RESOLVED] finding a relative path

    Hello,
    I need to find a way to find the "relative path" of my .swf from within itself via AS3. How do I find it's own 'relative path'?

    Thanks!
    -Jake

  2. #2
    Will moderate for beer
    Join Date
    Apr 2007
    Location
    Austin, TX
    Posts
    6,801
    You can use the url property of the loaderInfo associated with the swf.

  3. #3
    Member
    Join Date
    Jul 2008
    Posts
    40
    Thanks, that led me in the right direction... but I am still stumped

    Now what I need to do is to get the relative path of the FOLDER the swf is located in. How would this be accomplished?

    Thanks again!
    -Jake

  4. #4
    Will moderate for beer
    Join Date
    Apr 2007
    Location
    Austin, TX
    Posts
    6,801
    I think you mean 'absolute' rather than relative. The relative path of the swf is ".", and the relative path of the directory the swf is in is "..".

    But to get the absolute path of the folder the swf is in, use the url from the loaderInfo and use substring to remove the bit after the last "/". lastIndexOf can find that position.

  5. #5
    Member
    Join Date
    Jul 2008
    Posts
    40
    Thanks!! that is exactly what I needed!

    -Jake

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