Jump to content
Search Community

changing loaded Sound object to own expendeds sound object

youwh test
Moderator Tag

Recommended Posts

I'm trying to set some new properties to a sound and add in to a dictionary, something like 'name', 'categories', etc

My sound class:

package
{
	import flash.media.Sound;
	import flash.media.SoundLoaderContext;
	import flash.net.URLRequest;
	
	public class ExpendedSound extends Sound
	{
		public var name:String;
		public var categories:String;
		
		public function ExpendedSound(stream:URLRequest = null, context:SoundLoaderContext = null):void
		{
			super(stream, context);
		}
	}
}

but I can't seems to change or cast the loaded content to be ExpendedSound instead of a normal Sound object.

var sound:ExpendedSound = loader.getLoader('sound').content;

Anyway to solve this?

Link to comment
Share on other sites

Do you have an example of your class working with a Sound that does not come from MP3Loader?

I would definitely start there.

I'm having trouble understanding why the content of an MP3Loader (which is a Sound) wouldn't work but others would. 

 

I don't see in your code where you are actually casting a Sound as your ExpendedSound: http://upshots.org/actionscript-3/as3-casting-objects

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...