Here's another version:

var str:String = "http://www.yourDomain.com/dir1/dir2/dir3/preloader.swf";;
var intFirst:int = str.indexOf(".com/") +5;
var intLast:int = str.lastIndexOf("/")+1;
var intPathLen:int = intLast - intFirst;
// ----
var serverName:String = str.substr( 0, intFirst );
var directoryPath:String = str.substr( intFirst, intPathLen );
var fileName:String = str.substr( intLast );
// ----
trace( "serverName: "+serverName, "\ndirectoryPath: "+directoryPath,
"\nfileName: "+fileName );


Cheers,
Bob

-----Original Message-----
From: flashcoders-boun...@chattyfig.figleaf.com
[mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of maurice
sallave
Sent: Wednesday, June 03, 2009 3:11 PM
To: Flash Coders List
Subject: Re: [Flashcoders] swf paths...

Thanks for the replies.  I'll be looking into both.

kind of been playing around with this as well:
str = _url;
slash = str.lastIndexOf("/");
str = str.substring(slash+1, str.length);
dot = str.lastIndexOf(".");
filename = str.substring(0, dot);
directoryLocation = _url.split(filename + ".swf").join("");

and setting it to frame 1.

On Wed, Jun 3, 2009 at 2:15 PM, Robert Leisle <b...@headsprout.com> wrote:

> Hi Maurice,
>
> How about sending it in as a URL variable when you load preloader.swf into
> the html page?
>
> In the HTML:
> <object .....>
>        <param name="movie" value="swf/preloader.swf?path=swf/" />
>        ...
>        <embed src="swf/preloader.swf?path=swf/" .../>
> </object>
>
> Then in preloader.swf:
> var ojtParams:Object = this.loaderInfo.parameters;
> var swfPath:String = ojtParams.path;
>
>
> hth,
> Bob
>
>
> -----Original Message-----
> From: flashcoders-boun...@chattyfig.figleaf.com
> [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of maurice
> sallave
> Sent: Wednesday, June 03, 2009 1:30 PM
> To: flashcoders@chattyfig.figleaf.com
> Subject: [Flashcoders] swf paths...
>
> Hello!
> First time on here, so thanks for any advice.
> I'm pulling in a preloader.swf file into an html file that sits at root
> "swf/preloader.swf".  All my swf's are located in a swf directory that
gets
> preloaded into this preloader.swf - simple enough.  I'd like to try to
keep
> my server as clean as possible without having to hard-code the path into
> the
> preloader.swf file and don't want to use flashvars as a way of referencing
> my targeted path. Is there another way of doing this?  Of course if I put
> the html file inside the swf directory, everything works, but it defeats
> the
> purpose of keeping my server organized. I hope this makes sense and again
> thanks in advance.
> _______________________________________________
> Flashcoders mailing list
> Flashcoders@chattyfig.figleaf.com
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
>
> _______________________________________________
> Flashcoders mailing list
> Flashcoders@chattyfig.figleaf.com
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to