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