What the who honk you talkin¹ about!!! You can stick a script block just
about anywheres... The error sounds like it¹s tellin¹ you that you may-haps
initialized yer micro-thingy wrongly.

BUTTS! Heh... I said butts. The error is a little sketchy though ­ it might
be due to broken xml or a half a dozen other items. For a sanity check ­ can
you post the entire example? It would help us find the root cause of the
exception. For reference... The following code block compiles without
issues; script block placement does not appear to be the root cause.

<?xml version="1.0" encoding="utf-8"?>
<mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml"; width="400" height="300">

<mx:Script>
    <![CDATA[
        
        public var m:Microphone = Microphone.getMicrophone(0);
        
    ]]>
</mx:Script>
    
</mx:VBox>


Rick Winscot



On 7/31/08 7:33 PM, "Paul Andrews" <[EMAIL PROTECTED]> wrote:

>  
>  
> 
>  
>>  
>> ----- Original Message -----
>>  
>> From:  Jo  Morano <mailto:[EMAIL PROTECTED]>
>>  
>> To: [email protected]
>>  
>> 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.
>  
> Paul
>  
>>  
>>  
>>  
>> 
>> 
>> Regards
>>  
>  
>     


Reply via email to