Moving the script up to the application level didn't help. I've put the code from the book which should just compile (using an app now and moving vbox below):
<?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" width="400" height="300" creationComplete="createMic()"> <mx:Script> <![CDATA[ import flash.media.Microphone; import flash.events.ActivityEvent; import flash.events.Event; import flash.events.StatusEvent; public var mic:Microphone;// = Microphone.getMicrophone(); // <--- gives the error ]]> </mx:script> <mx:VBox> </mx:VBox> </mx:Application> It still doesn't compile. --- Hi! I am going over the examples in Flex 3 Cookbook and the one that allows connecting to user's microphone (page 243) has a compilation error. What's the best way to fix that? <VBox> <mx:Script> <![CDATA[ import flash.media.Microphone; public var mic:Microphone; // <-- error: constructor functions must be instance methods. Does anyone know what's wrong? Regards