You cant have any calling of member functions outside functions so 
s.addEventListener needs to be in a function and everything needs to be in a 
function with the exception of variables. so s.load(req) needs to be in a 
function.




----- Original Message ----
From: Shaq <[EMAIL PROTECTED]>
To: [email protected]
Sent: Monday, July 14, 2008 10:35:40 PM
Subject: [flexcoders] Access of undefined property flash.media.sound


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.URLReques t;

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