----- Original Message ----- 
  From: Paul Andrews 
  To: flexcoders@yahoogroups.com 
  Sent: Friday, August 01, 2008 12:33 AM
  Subject: Re: [flexcoders] Flex3 cookbook error in microphone example: 
constructor functions must be instance methods



    ----- Original Message ----- 
    From: Jo Morano 
    To: flexcoders@yahoogroups.com 
    Sent: Thursday, July 31, 2008 9:40 PM
    Subject: [flexcoders] Flex3 cookbook error in microphone example: 
constructor functions must be instance methods


    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?


  Yes, you can't just dump a script with a variable declaration into the middle 
of a VBox.

  You can add that kind of declaration into a function (but not in the middle 
of a VBox), or in a 'proper' actionscript 3 class.

I should add that switching removing the VBox and putting that code at the 
application level will make the example work.
  Paul

    Regards

Reply via email to