2 Replies Latest reply on Jun 13, 2009 1:00 AM by leybniz

    Inserting external swf "Widgets" into a Flex app

    mdverde

      Hi.

       

      I need to insert several external widgets into my Flex application. For example the Twitter flash widget and flickr slideshows widget.

       

      Those widgets normally give you HTML code to insert in your HTML page, like:

       

      <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,124,0" width="290" height="350" id="TwitterWidget" align="middle">
          <param name="allowScriptAccess" value="always" />
          <param name="allowFullScreen" value="false" />
          <param name="movie" value="http://static.twitter.com/flash/widgets/profile/TwitterWidget.swf" />
          <param name="quality" value="high" />
          <param name="bgcolor" value="#000000" />
          <param name="FlashVars" value="userID=xxxxxx&styleURL=http://static.twitter.com/flash/widgets/profile/smooth.xml">
          <embed src="http://static.twitter.com/flash/widgets/profile/TwitterWidget.swf" quality="high" bgcolor="#000000" width="290" height="350" name="TwitterWidget" align="middle" allowScriptAccess="sameDomain" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" FlashVars="userID=xxxxxx&styleURL=http://static.twitter.com/flash/widgets/profile/smooth.xml"/>
      </object>

       

      I'm trying to achieve the same goal in my Flex application using the SWFLoader control, but I've got a lot of troubles starting with security issues, and although I just learned to pass the FlashVars values, I don't know how to pass the "<param" values.

       

      public var twitterWidgetSrc:String = "http://static.twitter.com/flash/widgets/profile/TwitterWidget.swf?userID=xxxxxx&styleURL=h ttp://static.twitter.com/flash/widgets/profile/smooth.xml";

       

                  <mx:SWFLoader
                      id="twitterWidget"
                      source="{twitterWidgetSrc}"
                      height="290" width="350"
                      init="setSecurity();">
                  </mx:SWFLoader>

       

      Is there an easier way to insert these widgets into my Flex application? or how can I complete the SWFLoader to achieve the same results?