Archive for the ‘html’ Category

Trigger Javascript functions from Flash AS3

Thursday, February 4th, 2010

Using the ExternalInterface in AS3 it’s never been easier to trigger Javascript functions on your page that holds your swf.
Previously with AS2 and below We would have used the getURL(“javascript:yourFunction();”) or
fscommand(“messagebox”, “Message box called from within Flash.”)

I was asked on the forums today how this would be done in AS3.

After quickly looking up ExternalInterface in the flash Doc’s I was able to through together a quick working example.
A working example can be seen here.

Here is the code:

// import classes we need
  1. import flash.external.*;
  2. import flash.net.*;
  3. //Make sure buttons show mouse over
  4. but1.buttonMode=true;
  5. but2.buttonMode=true;
  6. but3.buttonMode=true;
  7. //Added mouse event to buttons
  8. but1.addEventListener(MouseEvent.MOUSE_DOWN,triggerJavascript,false,0,true);
  9. but2.addEventListener(MouseEvent.MOUSE_DOWN,triggerJavascript,false,0,true);
  10. but3.addEventListener(MouseEvent.MOUSE_DOWN,triggerJavascript,false,0,true);
  11.  
  12. //Function to be triggered by mouse event
  13. function triggerJavascript(e:Event) {
  14. //check name of button pressed
  15. switch (e.target.name) {
  16. case "but1" :
  17. //open url in fixed size popup
  18. ExternalInterface.call("openPopup", "http://www.innovativedesigns.org.uk");
  19. break;
  20. case "but2" :
  21. //open url in new window
  22. ExternalInterface.call("openURL", "http://www.innovativedesigns.org.uk");
  23. break;
  24. case "but3" :
  25. //trigger javascript alert box
  26. ExternalInterface.call("triggerAlert", "Alert was triggered from Flash");
  27. break;
  28. }
  29. }

DOPE Awards html site goes live

Friday, November 20th, 2009

logoFor the past couple of months I’ve been working very hard converting the current DOPE Awards.com flash site over to HTML. That’s not to say the Flash site is going to disappear this is more to improve SEO with the site. The main aspect of this project was to have the html version of the site as near identical of the flash site.  Looking at the DOPE Awards html version of the site i think it’s pretty close and I hope you think so to.

Coming from a flash background of 8+ years this certainly was going to be a challenge. Well a few months later and it is finished. The site fully conforms to W3C and is also cross browser compatible on most popular browsers and even IE8.

Dope Flash website awards

Dope Flash website awards

Be sure to check out DOPE Awards.com as there is some great new features coming it’s way soon.  Also if you think you have a site Dope Awards worthy then why not get it posted.

Missing ALT tooltips in Firefox

Friday, June 12th, 2009

Forgive me if this is old news. So here i am working on html version of dopeawards.com So most of it is done and we’re just run through everything is set to make the most of Search engine optimization (SEO) and noticed that all alt tags on out images are not working in firefox but are in IE.
Not sure if this was common knowledge in the html circle with me being a flash developer ;) .
It turns out IE should not be displaying alt messages in tooltips, that’s what the title attribute is for.
Don’t stop using the alt attribute, that’s required for accessibility. So your best bet is to include both an alt attribute, and a title attribute in your img tags if you want a tooltip.

An easy quick fix :)