In my experience, the compiler gets unhappy when one tries to run code
outside of a function inside of a script tag. My guess is that it is a
timing issue. I would try putting your code into an init function, and
calling it with an event such as creationComplete.

--- In [email protected], "Shaq" <[EMAIL PROTECTED]> wrote:
>
> The code below is pulled from the Flex 3 manual but I am unable to get
> it to compile correctly using Flex 3.  Can anyone provide any insight
> as to why the code below raises the following errors:
> 1120: Access of undefined property onSoundLoaded.
> 1120: Access of undefined property req.
> 1120: Access of undefined property s.
> 
> Any help would be greatly appreciated.
> 
> <?xml version="1.0" encoding="utf-8"?>
> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";
> layout="vertical">
>       <mx:Script>
>               <![CDATA[
>                       import flash.events.Event;
>                       import flash.media.Sound;
>                       import flash.net.URLRequest;
>                       
>                       private var s:Sound = new Sound();
>                       s.addEventListener(Event.COMPLETE, onSoundLoaded);
>                       private var req:URLRequest = new
URLRequest("../korotkoff_stereo.mp3");
>                       s.load(req);
>                       
>                       private function onSoundLoaded(event:Event):void
>                       {
>                           var localSound:Sound = event.target as Sound;
>                           localSound.play();
>                       }
>               ]]>
>       </mx:Script>    
> </mx:Application>
>


Reply via email to