5 Flash Tips: onLoad Event Handler Not Working With loadMovie?
Tip #1: Neat Fix - onLoad Bug
I have heard so many people moan on the many community forums and
mailing lists about the onLoad event handler not working with loadMovie
and although I have already posted a fix for the problem
(www.actionscripts.org/forums/showthread.php3?threadid=13830), I found
this very small and functional fix that does the same thing, a while
ago on the Flashcoders Mailing List:
http://chattyfig.figleaf.com/mailman/htdig/
flashcoders/2002-October/049415.html and so if you see the question,
forward people to http://chattyfig.figleaf.com/apache2-default/.
Tip #2: Bug - Sound.loadSound & GetRight
If you have GetRight
(www.download.com/GetRight/3000-2071_4-10005533.html) 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 does not load the file into the player, which
raises an issue.
GetRight is one of the most, if not the most popular download
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 extension of
your mp3 files to something which is not 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 extension,
then this will not solve the problem. Changing the mime-type is not
only a complex process for novices, it will not solve the problem,
because the Flash Player will not play the file if its MIME-type is not
set to type mp3.
Tip #3: Stage.showMenu
It is 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 isn not 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;
Tip #4: 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 (www.macromedia.com/support/flash/documentation/
flash_mx_errata/flash_mx_errata03.html).
Tip #5: 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 you 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 a lot of faffing around! Think this
is something else I was slow on, these little fine details just fly
over my head.
POSTED BY Flash Insider AT 4/16/2008 10:19 AM
0 COMMENTS
» POST A COMMENT
| DIGG IT
« BACK HOME
|