tags:

views:

206

answers:

0

I have a Gigya Flex component:

<?xml version="1.0" encoding="utf-8"?>
<mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml" 
    width="350" 
    height="300" 
    backgroundColor="#12913A"
    hideEffect="{hideEffect}">

    <mx:Metadata>
     [ Event( name="finished", type="flash.events.Event") ]
    </mx:Metadata>

    <mx:VBox verticalGap="10" width="100%" height="100%"
     paddingTop="10">
     <mx:HBox id="wfLoaderBox" width="100%" height="250" creationComplete="{WFInit();}" 
      horizontalCenter="true" horizontalAlign="center" />
     <mx:HBox width="100%" horizontalCenter="true" horizontalAlign="center">
      <mx:Button id="finishedButton" label="Finished"
        height="{getStyle('fontSize') + 6}"
              click="{onCancelClicked()}" hideEffect="{hideEffect}" />
     </mx:HBox>
    </mx:VBox>

    <mx:Fade id="hideEffect" duration="300" effectEnd="{PopUpManager.removePopUp(this);}"/>
    <mx:Script>
    <![CDATA[
        import mx.events.DynamicEvent;
        import mx.managers.PopUpManager;
        public var cfg:Object = {};

        public static const EVENT_FINISHED:String = "finished";

        private function onCancelClicked():void {
      visible = false;  // This will trigger hideEffect, which will remove it from PopUpManager.
      dispatchEvent(new Event("finished"));
     }

        public function WFInit():void{
            Security.allowDomain("cdn.gigya.com");
            Security.allowInsecureDomain("cdn.gigya.com");

            if(wfLoaderBox.numChildren > 0 ){
                wfLoaderBox.visible = true;
                return;
            }

      //This code assigns the configurations you set in our site to the Wildfire configuration object
      cfg['width']='300';
      cfg['height']='250';
      cfg['showCloseButton']='false';
      cfg['useFacebookMystuff']='false';
      cfg['partner']='my_partner_id';
      cfg['UIConfig']='<config baseTheme="v2"><display showEmail="true" showBookmark="true" codeBoxHeight="auto"></display><body><controls><snbuttons iconsOnly="true"></snbuttons></controls></body></config>';

            // Please set up the content to be posted
            cfg['defaultContent']= ''; // <-- YOUR EMBED CODE GOES HERE 

            // You can set different content for each network
            //cfg['myspaceContent']='';
            //cfg['friendsterContent']='';
            //cfg['facebookContent']='';
            //cfg['taggedContent']='';
            //cfg['bloggerContent']='';
            //cfg['hi5Content']='';
            //cfg['freewebsContent']='';
            //cfg['xangaContent']='';
            //cfg['livejurnalContent']='';
            //cfg['blackplanetContent']='';
            //cfg['piczoContent']='';
            //cfg['wordpressContent']='';
            //cfg['typepadContent']='';

            //cfg['bulletinSubject']='';  // The subject for bulleting messages of your content
            //cfg['bulletinHTML']='';   // code for the bulletin, if it is different than the defaultContent 

            //cfg['facebookURL']=''; // If you have your own facebook application you can set it's URL here

            // set up an event handler for the postProfile event, this is called when the used completed the proccess of posting to his profile.
            cfg['onPostProfile']=function(eventObj:Object):void{
             trace('event fired eventObj.type='+eventObj.type + ' eventObj.network='+eventObj.network +' eventObj.partnerData='+eventObj.partnerData);
            }

            // set up an event handler for the onLoad event, this is called when the Wildfire UI is loaded.
            cfg['onLoad']=function(eventObj:Object):void{
             trace('event fired eventObj.type='+eventObj.type + 'eventObj.ModuleID='+eventObj.ModuleID);
            }

            // set up an event handler for the onClose event, this is called when the Wildfire UI is closed.
            cfg['onClose']=function(eventObj:Object):void{
                //add here code to hide
                wfLoaderBox.visible = false;
                MovieClip(Loader(mx.core.UIComponent(wfLoaderBox.getChildAt(0)).getChildAt(0)).content).INIT();                 
            }


            var wfLoader:flash.display.Loader;
            wfLoader=new flash.display.Loader();

            if (wfLoaderBox.numChildren == 0 ) {
             wfLoader.contentLoaderInfo.sharedEvents.addEventListener("sendConfig",
                function(e:Event):void{
                  var evtObj:mx.events.DynamicEvent=new mx.events.DynamicEvent('onStoreConfig');
                  evtObj.cfg=cfg;
                  wfLoader.contentLoaderInfo.sharedEvents.dispatchEvent(evtObj);
                }
              )

             wfLoader.contentLoaderInfo.addEventListener(Event.COMPLETE,
               function(event:Event):void{
                  var uic:mx.core.UIComponent = new mx.core.UIComponent();
                  wfLoaderBox.addChild(uic);
                  uic.addChild(wfLoader);
                }
             ); 

          // Load Wildfire
          wfLoader.load(new URLRequest('http://cdn.gigya.com/wildfire/swf/wildfireInAS3.swf?ModuleID=cfg'));

            }
            else {
              MovieClip(Loader(mx.core.UIComponent(wfLoaderBox.getChildAt(0)).getChildAt(0)).content).INIT();
            }
     }
    ]]></mx:Script>
</mx:Canvas>

From my main view in my app, I basically embed this component. I wanted to do it as a popup like so:

private function shareThisQuiz():void{
       results.enabled = false;
       var gigya:Gigya = new Gigya();
       PopUpManager.addPopUp(gigya, this);
       PopUpManager.centerPopUp(gigya);

       gigya.addEventListener(Gigya.EVENT_FINISHED, gigyaFinished);
      }

but this crashes my app. So for now I have to do it like:

<comps:Gigya id="gigya" visible="false" finished="gigyaFinished()" />

and set it to visible when I want to "pop it up". Does anyone know why this would crash my app (and browsers)?

Thanks!