Posted By

arpo on 06/30/09


Tagged


Versions (?)

Who likes this?

4 people have marked this snippet as a favorite

macKaminski
iamgowan
TrentSkunk
dubogii


Change HTML background colour


 / Published in: ActionScript 3
 

  1. import flash.external.*;
  2.  
  3. btn.addEventListener(MouseEvent.CLICK, function() {
  4. var jsCall:String;
  5. jsCall = String(ExternalInterface.call("changeBgColor", "#fffecb"));
  6. trace("Click")
  7. });
  8.  
  9.  
  10. //And in the HTML code
  11. <script language="JavaScript">
  12. function changeBgColor(newBgColor)
  13. {
  14. if (window.document && window.document.bgColor)
  15. {
  16. document.bgColor = newBgColor;
  17. }
  18. }
  19. </script>

Report this snippet  

Comments

RSS Icon Subscribe to comments
Posted By: bob86 on August 3, 2009

For some reason the actionscript is giving me errors. Any idea why?

Posted By: bob86 on August 3, 2009

For some reason the actionscript is giving me errors. Any idea why?

Posted By: arpo on August 26, 2009

There was a " missing and it also was in AS2. Now it's updated.

You need to login to post a comment.