4

I have a swf file created by EasyPano tourweaver software. the outpout is a swf file with some .bin files to config the swf and other files such as .jpg, .js and so on. The software create a html file to add the swf but i have to load the swf using flash and AS3. the HTML and JavaScript that the software create is :

 <html> 
 <head> 
 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
 <title>Mahan</title> 
 </head> 
 <body leftMargin="0" topMargin="0" rightMargin="0" bottomMargin="0"> 
 <script type="text/javascript" src="swfobject.js"></script> 
 <div id="flashcontent"> 
 To view virtual tour properly, Flash Player 9.0.28 or later version is needed. 
 Please download the latest version of <a href="http://www.adobe.com/go/getflashplayer" target="_blank">Flash Player</a> and install it on your computer.
 </div> 

 <script type="text/javascript"> 
 // <![CDATA[ 
 var so = new SWFObject("twviewer.swf", "sotester", "100%", "100%", "9.0.0", "#000000"); 
 so.addParam("allowNetworking", "all"); 
 so.addParam("allowScriptAccess", "always"); 
 so.addParam("allowFullScreen", "true"); 
 so.addParam("scale", "noscale"); 
 //<!-%% Share Mode %%->
 so.addVariable("lwImg", "resources/talarmahan_1_firstpage.jpg"); 
 so.addVariable("lwBgColor", "255,255,255,255"); 
 so.addVariable("lwBarBgColor", "255,232,232,232"); 
 so.addVariable("lwBarColor", "255,153,102,153"); 
 so.addVariable("lwBarBounds", "-156,172,304,8"); 
 so.addVariable("lwlocation", "4"); 
 so.addVariable("lwShowLoadingPercent", "false"); 
 so.addVariable("lwTextColor", "255,0,0,204"); 
 so.addVariable("iniFile", "config_TalarMahan.bin"); 
 so.addVariable("progressType", "0"); 
 so.addVariable("swfFile", ""); 
 so.addVariable("href", location.href); 
 so.write("flashcontent"); 
 // ]]> 
 </script> 
 </body> 
 </html>

Please Help me!

Thanks

1 Answer 1

2

The answer is URLVariables passed to the URLRequest feed into load method of Loader:)

example:

        var loader:Loader = new Loader();
        var flashvars:URLVariables = new URLVariables()
            flashvars["lwImg"] = "resources/talarmahan_1_firstpage.jpg";
            flashvars["lwBgColor"] = "255,255,255,255";
            flashvars["lwBarBgColor"] = "255,232,232,232";
            flashvars["lwBarColor"] = "255,153,102,153";
            flashvars["lwBarBounds"] = "-156,172,304,8";
            flashvars["lwlocation"] = "4";
            flashvars["lwShowLoadingPercent"] = "false";
            flashvars["lwTextColor"] = "255,0,0,204";
            flashvars["iniFile"] = "config_TalarMahan.bin";
            flashvars["progressType"] = "0";
            flashvars["swfFile"] = "";
            flashvars["href"] = this.loaderInfo.url;
        var request:URLRequest = new URLRequest("twviewer.swf");
            request.data = flashvars;
        loader.load(request);

        addChild(loader);

also with following helper method you can get main SWF parameters (from it's html wrapper) and pass it to the loaded SWF:

    public function getFlashVars(li:LoaderInfo):URLVariables
    {
        var vars:URLVariables = new URLVariables();
        try
        {
            var params:Object = li.parameters;
            var key:String;
            for(key in params)
            {
                vars[key] = String(params[key]);
            }
        }
        catch(e:Error)
        {
        }
        return vars;
    }

then

        var loader:Loader = new Loader();
        var request:URLRequest = new URLRequest("twviewer.swf");
            request.data = getFlashVars(this.loaderInfo);
        loader.load(request);

        addChild(loader);

For SecurityError: Error#2000 and here - there are many reasons behind this error

Sign up to request clarification or add additional context in comments.

5 Comments

Thnaks for your answer. But now i have Security error : SecurityError: Error #2000: No active security context.
I've updated question to include some SO SecurityError solutions, have you checked them?
I can't fix it. can i mail a sample project to you? i thinks it's a simple error but i can't fix it. please help me.
does it work localy? does it work when hosted on line? - you can mail it to me
it is in my profile also you can find in my blog in "about" page

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.