Archive for category ActionScript 3.0
Here’s something that’s been around for a while that I didn’t learn about until just recently.
flash.system.capabilities.playerType property can be used to tell whether you’re running in the browser, a standalone player, or the Flash IDE. It returns the following values (from Adobe’s documentation):
- “ActiveX” for the Flash Player ActiveX control used by Microsoft Internet Explorer
- “Desktop” for the Adobe AIR runtime (except for SWF content loaded by an HTML page, which has Capabilities.playerType set to “PlugIn”)
- “External” for the external Flash Player or in test mode
- “PlugIn” for the Flash Player browser plug-in (and for SWF content loaded by an HTML page in an AIR application)
- “StandAlone” for the stand-alone Flash Player
Simply check for
(flash.system.capabilities.playerType == "ActiveX" || flash.system.capabilities.playerType == "PlugIn") and you’ll know you’re in a browser.
By now some of you are probably familiar with Crash Flash CS4’s bad crashing habit.
The majority of these crashes can be fixed with the 10.0.2 Hotfix, but I was consistently seeing one that the update didn’t fix.
On Mac OS 10.5.8, with Flash CS4 10.0.2, Flash would crash anytime I tried to add a custom component I had built and put in the Components library. I have been developing and using this component for almost 4 years, and had never seen this problem before.
I tried every fix that Google had to offer, including dumping fonts, resetting flash, deleting preferences, re-building the component, and nothing worked. Every time I tried to add that component to my Flash file, it would crash without fail. (Or maybe with fail, since it was, after all, crashing….)
I was going through everything, trying to figure out what the problem could possibly be, and I noticed that in the component’s FLA file, there was an entry that was nothing but a period underneath the other folder locations.
Removing that period and re-exporting the SWC solved the crash problem.
A reader commented on my ScrollPane article, saying “why wouldn’t they just say that?”
I’ve found myself asking this question more and more as I’ve been diving into Flex and ActionScript 3.
For example, here is how to get the name of the root node of an XML object:
nodeName has mysteriously disappeared, and the Migration Guide makes no mention of
name() as its new equivalent.
In fact, the XML Class Definition for ActionScript 3 describes
name() as “Gives the qualified name for the XML object.”, which led me to believe it was relevant only namespace-qualified XML tags and not useful for getting a root node’s name.
Splitting hairs, perhaps, but a good little tip nonetheless.