website promotion banner
eturnkeys
Your Ad Here
Flash & Swish  Home Flash & Swish Articles Guy Watson's Tips
rss

Guy Watson's Tips

Author: Guy Watson More by this author


Guy Watson's Tips Neat Fix - onLoad Bug

Ive heard so many people winge on the many community forums and mailing lists lately about the onLoad event handler not working with loadMovie and although i posted a fix for the problem sometime ago, i found this very small and functional fix that does the same thing, a while ago on the Flashcoders Mailing List and so if you see the question, forward people to that page.

Bug: Sound.loadSound & GetRight

If you have GetRight installed on your computer, a download management utility and you view a Flash movie that attempts to load an mp3 sound file into the flash player dynamically using the Sound.loadSound method, GetRight stops the loading of the mp3 file and asks you to choose a location to save the mp3 file on your local computer, whether you choose to download the file or not, flash still doesnt load the file into the player, which raises an issue. GetRight is one of the most, if not the most popular downloand utility and this is the default behaviour of the program, of course these settings can be changed, by removing the hook for mp3 files but Flash alone cannot do this automatically for you, this is a manual process that viewers of your site will have follow if they want to listen to dynamically loaded sounds on your site...

To fix the problem, i assume that by changing the file exstension of your mp3 files to something which isnt registered as a download hook in GetRight will do the trick, but of course, if GetRight actually checks the mime-type of the file instead of using the files exstension, then this will not solve the problem. Changing the mime-type is not only a complex process for novices, it wont solve the problem, because the Flash Player will not play the file if its mime-type is not set to type mp3.

Stage.showMenu

Its all in the name, Stage.showMenu is a Boolean property of the Stage object that defines whether to display the menu or not, when the user right-clicks on your flash movie.

A boolean value is either true or false, 0 or 1, on or off, the Stage.showMenu value can either be true or false:

  • true - Show the menu on right-click
  • false - Down show the menu on right-click

Please bear in mind, that this isnt the answer to all our prayers, when you turn the right-click menu off, the 'About Flash 6 Player' and 'Settings' options are still displayed, so no, you cant 'fully' remove the right-click menu. The actionscript:

//turn off the right-click menu
Stage.showMenu=false;

System.security.allowDomain

This undocumented method grants permission for the specified domain(s) to access objects and variables in the flash movie that calls the allowDomain command. This property had to be implemented because of the changes made to the Security Sandbox in the Flash 6 Player...

I have two movies, 'a.swf' and 'b.swf', 'a.swf' is located on www.flashguru.co.uk server and 'b.swf' is located on www.macromedia.com server, for 'a.swf' to be able to access the contents of 'b.swf', 'b.swf' has to make a call to the allowDomain command as follows:

System.security.allowDomain("http://www.flashguru.co.uk");

The domain can be formatted in numerous ways, the same different formats that the loadVariables, loadVariablesNum, xml.load and loadvars.load methods accept:

  • http://www.domain.com
  • http://domain.com
  • domain.com
  • http://IpAddress

You can pass multiple domains to the method as arguments. This method has been documented in the Macromedia Flash MX Actionscript Dictionary Errata.

Test Player: System Keys

By default, in the local test player(Control > Test Movie), if you try and press the enter key, to test some code that uses it, your code will not work because the player over-rides the key press as a keyboard shortcut to pause and play the movie, the same goes for the tab key and other important system keys, such as Ctrl, Shift etc... So if you want to test your tabIndexes in the test player, so u can use trace and the debugger, simply select Disable Keyboard Shortcuts from the Control menu (Control > Disable Keyboard Shortcuts) and your code will now recieve the key presses. Saves me alot of faffing around! Think this is something else i was slow on, these little fine details just fly over my head.



Rate this Material: Bad 1 2 3 4 5 Excellent
print this page tell a friend subscribe to newsletter subscribe to rss

Add comments to "Guy Watson's Tips"