开发者

Unable to pass flashvars to flex generated swf

Unable to pass flashvars to flex generated swf

        import com.rubenswieringa.interactivemindmap.*;

        private var fullscreenListenerAdded:Boolean = false;

        private function onCreationComplete ():void {
            Controller.boot(this.springGraph, "assets/mindmap.xml");
            Security.allowDomain("dual99.com");
        }

        private function fullscreen (event:Event=null):void {
            if(!this.fullscreenListenerAdded){
                this.fullscreenListenerAdded = true;
                Application.application.stage.addEventListener(Event.FULLSCREEN, this.onFullscreen);
            }
            Ap开发者_StackOverflow中文版plication.application.stage.displayState = StageDisplayState.FULL_SCREEN;
        }

        private function onFullscreen (event:Event):void {
            this.fullscreenButton.visible = (Application.application.stage.displayState == StageDisplayState.NORMAL);
        }
        // Declare bindable properties in Application scope.
        [Bindable]
        public var myName:String;
        [Bindable]
        public var myHometown:String;

        // Assign values to new properties.
        private function initVars():void {
        myName = Application.application.parameters.myName;
        myHometown = Application.application.parameters.myHometown;
        }

    ]]>
</mx:Script>

This is in the html

<script type="text/javascript">
    // <![CDATA[

    var so = new SWFObject("flash.swf", "flasher", "100%", "100%", "9", "#FFFFFF");
    so.addParam("allowFullScreen", "true");
    so.addVariable("myName","samvirtual");
    so.addVariable("myHometown","canton");
    so.write("flashcontent");

    // ]]>
</script>


My guess is that you're calling initVars too soon. Try adding it to the creation complete handler:

private function onCreationComplete ():void {
   Controller.boot(this.springGraph, "assets/mindmap.xml");
   Security.allowDomain("dual99.com");
   myName = Application.application.parameters.myName;
   myHometown = Application.application.parameters.myHometown;
}


try to use

private function initVars():void {        
  var paramObj:Object = LoaderInfo(root.loaderInfo).parameters;
  myName = paramObj.myName;
  myHometown = paramObj.myHometown;
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜