The new forums will be named Coin Return (based on the most recent vote)! You can check on the status and timeline of the transition to the new forums here.
Please vote in the Forum Structure Poll. Polling will close at 2PM EST on January 21, 2025.
For some reason generates an error, saying that mixer is an undefined property. I tried changing private to public and removing it all together, zero difference.
If I do a this. then mixer will show up as a property but you can't access variables in that way in an MXML application.
This is the first time I've ever used anything outside of primitive data types so I'm not sure why it doesn't like this... the code is practically cut and paste from Adobe's documentation.
When you put script data in an application like that, what Flex actually does is generate a class that looks something like:
class MyApp extends Application
{
...
import flash.media.*;
private var mixer:SoundMixer = SoundMixer();
mixer = null;
...
}
Strangely enough, ActionScript lets you run code at the global class level like this. But at that level, it's not associated with any specific instance, and can only see static properties of the class. (Try putting private static var mixer, and you'll see it works.)
What you really want to do is put the code inside a method that gets called on initialization, by the constructor or by the initialize event:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" initialize="init()">
<mx:Script>
<![CDATA[
import flash.media.*;
private var mixer:SoundMixer = new SoundMixer();
public function init():void
{
mixer = null;
}
]]>
</mx:Script>
</mx:Application>
Also, I think the SoundMixer class has only static methods, so there's no need to instantiate it. You can just do, e.g. SoundMixer.computeSpectrum()
Posts
Strangely enough, ActionScript lets you run code at the global class level like this. But at that level, it's not associated with any specific instance, and can only see static properties of the class. (Try putting private static var mixer, and you'll see it works.)
What you really want to do is put the code inside a method that gets called on initialization, by the constructor or by the initialize event:
Also, I think the SoundMixer class has only static methods, so there's no need to instantiate it. You can just do, e.g. SoundMixer.computeSpectrum()
good luck!