Categories
AS3 AS3 migration Flash

From AS2 to AS3 – Where did it go – attachSound

Where did attachSound go in AS3?

It’s almost the same as attachMovie (I already covered attachMovie: read attachMovie post)

I was never very good in sound, and I didn’t use it a lot in my applications/animations. That changed with my new job. But for the people that remember attachSound in AS2, this is how its done in AS3…

This post is only handy when you link sound from the library, both AS2 and AS3. Dynamically loaded sound (MP3) is another story.

What has the ActionScript 2.0 Migration to say about this subject:

ActionScript 2.0  ActionScript 3.0  Comments
attachSound() Method Removed Create an instance of a Sound subclass that is associated with sound data; for example, by using new Sound() instead.

And I say again: Removed… wtf? 😉

In AS2 it will work like this: