TwelvestoneFlash

can't get sound to work in my class


Sign in

  • Waiting for Godot ( 720 k posts )
    Just conversation.
  • Thunder Dome ( 23 k posts )
    Photoshop Tennis and Collabs.
  • Photography ( 4.8 k posts )
    For all you shutterbugs, sh...
  • Flash ( 18 k posts )
    ActionScripting to tweens, ...
  • Front End ( 5.8 k posts )
    general front end design an...
  • Back End ( 9.6 k posts )
    serverside scripting, progr...
  • Projects and Theory ( 12 k posts )
    This forum is for discussio...
  • FAQ ( 269 posts )
    All those nagging questions...
  • Design ( 17 k posts )
    graphics & all aspects of g...
  • Purgatory ( 3.6 k posts )
    12stone Jail, feel free to ...
JERKSTORE
 
2009-11-19

This is AS2

import mx.utils.Delegate; import mx.transitions.Tween; import mx.transitions.easing.*;

class com.site.content.Book extends MovieClip { private var bookMusic:Sound = new Sound(); ... }

The error I get is: > A class's instance variables may only be initialized to compile-time constant expressions.

and then it lists the var declaration shown above as the issue.

Is there an include I'm missing (if so I looked through the MX folder but couldn't find it). Can I not use Sound in a MovieClip object?

lithium
 
2009-11-19

i'm not sure if you can instantiate sounds at declaration-time.

try :

import mx.utils.Delegate; import mx.transitions.Tween; import mx.transitions.easing.*;

class com.site.content.Book extends MovieClip { private var bookMusic:Sound;

    public function Book()
    {
          bookMusic = new Sound();
    }

}

haven't worked in as2 for years so it might be a long shot :shrug:

A.

JERKSTORE
 
2009-11-19

Yeah, that was it. I had tried that earlier, but an ID10T error prevented it from working as it should, which is why I was so lost.

Got it working now.

Thanks for the reply k

Sorry, you must be a member to post to a conversation. Either log in or sign up to get involved.
TwelvestoneFlash

can't get sound to work in my class