3 Replies Latest reply on Jan 13, 2011 12:17 PM by Ned Murphy

    Change HTML background color with AS3

    yalp.com.br Level 1

      Hi all,

       

      I'm looking or a way to change my HTML background color trough Flash.

       

      The problem is it's not working any ideas? here is the code i'm using

       

      HTML HEAD

      <script language="JavaScript">
      function changeBgColor(newBgColor)
      {
      if (window.document && window.document.bgColor)
          {
              document.bgColor = newBgColor;
          }
      }
      </script>

       

      Flash document

      import flash.external.*;

       

      var jsCall:String;
      this.addEventListener(Event.ENTER_FRAME, bgChange)

       

      function bgChange(e:Event):void{
          jsCall = String(ExternalInterface.call("changeBgColor", "#FF0000"));
      }

       

      best regards!!!