views:

22

answers:

3

Hi!

I try to make an intro animation inside a website, and when the animation is done or when you push the Skip button, it navigates to the index.html file from the site root.

So I have in my site root the folder Flash, where the intro.swf is, and within the intro.swf I called the navigateToURL(new URLRequest("..\index.html"), "_self"); method. Now it's not working. Can you tell how to define the URL request please?

Thanks.

A: 

location of your swf file:

loaderInfo.loaderURL
www0z0k
+1  A: 

You know, I once had a weird scoping issue in Flex. The solution was to force an absolute URL by parsing the loaderInfo.loaderURL manually. A simple version might be:

function getAbsoluteURL( pathFromSwf:String, swfURL:String ):String
{
    // if pathFromSwf is already a URL, then just return that.
    if( pathFromSwf.match( /^(http.{3}[^\/]{5,})\/(.*)$/ ) ) return pathFromSwf;
    // this may need to be customized based on your extension/server settings.
    var basePath:Array = swfURL.substr( 0, swfURL.indexOf( ".swf" ) ).split( "/" );
    basePath.pop(); // clear out the swf's name.
    var altPath:Array = pathFromSwf.split( "/" );
    for( var i:int = 0; i < altPath.length; i++ )
    {
        // ".." subtracts from the path/
        if( altPath[ i ] == ".." ) basePath.pop();
        // otherwise append
        else basePath.push( altPath[ i ] );
    }
    return basePath.join( "/" );
}
Christopher W. Allen-Poole
+1  A: 

Have you tried this:

navigateToURL(new URLRequest("../index.html"), "_self");

Is using a backslash just a typo?

PatrickS