Using JSON.stringify() on an ActionScript XML class does not return a usable result. The XMLList class does not define toJSON() at all; in this case, JSON.stringify() returns the string resulting from a standard traversal of the object. How can I override this default behavior to customize how my XML or XMLList maps to JSON?
Solution
Way #1:
Convert XML object to Object and pass it into JSON.stringify method.
Way #2 (thanks Richard):
Override toJSON method (for XML) or add toJSON method (for XMLList) through prototype.
I want to access HTML element or Javascript function in flex
Solution
Using ExternalInterface class we can call javascript method from flex and also javascript can call actionscript method.
Using ExternalInterface.addCallback and ExternalInterface.call method we can do that. if ExternalInterface is available.
When you develop applications inside the Flash IDE you can see all the trace output inside Trace panel of IDE. However, there are lots of cases when you need to test your applications in browser and not as a standalone application. This makes impossible reading trace output and makes debugging your applications hard.
Solution
To see trace output outside the Flash IDE you need external application. In this article we will use applications called Vizzy.
The biggest question of most developers i encounter is this: this a good time to learn flash? is it to late to join the party? Is the next party going to be in flash or a different language is swiftly coming to take over (JavaScript?HTML5?)?
Solution
I know knowing things is important but what is the most bang on the buck? I'm going to attempt to prove how and why flash is still king when it comes to the most fun,profitable, and time effective platform to work on. Does that mean HTML5/Javasciprt is out? no not at all Flash isn't in the same play ground as Javascipt is and we will look into what that means as we explore a personalized perspective of web/dev history.
I'd like a brief example of how to scale assets, such as bitmap images, for use on multiple screens. For example, using a bitmap in a desktop application and in a mobile application.
Solution
If you want to scale assets, you can do that by getting the stage width and height, and based on that info, either scale down or reposition the graphics. Detailed explanation has the code but in general it's listening for the stage. RESIZE, and then adjusting graphics accordingly.
I'm looking for an example of using an accelerometer on a mobile device.
Solution
The good news if you want to understand the accelerometer is that the documentation on Adobe's site already provides some great examples. In fact, the initial portions of code for this tutorial are lifted straight from documentation which provides details on how to determine if the accelerometer is supported, establish the update interval and handler and even offers code that shows how to smooth out anomalies in the data it sends. Here's how to move an object around the screen using accelerometer data.
This site is produced in partnership with O'Reilly.