0 Replies Latest reply on Jan 10, 2011 1:13 AM by marcelozep3

    [as2] Class is not working

    marcelozep3

      Hi.

      I have two levels one for "movie1.swf" the other "movie2.swf",

      movie1 is on level 0, movie2 is on level 1.

      I made a class "MySound", a class that extends the Sound class.

      The problem is that I tried to use MySound class on movie2 and is not working.

      It only works when I use MySound class on level 0.

      Why?

       

      Other thing.

      The Sound class constructor function has a parameter "target" use to

      point to a object. I think it is use to setVolume and other things.

      How can I use the same method?

      I´ve tried to setVolume with my class ("MySound"), once for each

      sound and it worked for both, I mean, example, I have sounds "s1"

      and "s2", I tried to set the volume of s1 to 50 and s2 to 0 like this:

       

      s1.setVolume(50)

      s2.setVolume(0)

       

      But, both sounds volume were setted to 0.

       

      How can I use the same method of targeting an object so the setVolume

      works properly in MySound class?

       

      Note:

       

      MySound class has no constructor function declared, so I thought it could

      work the same as Sound class.

       

      How can I use setVolume method in MySound class?

       

      The main reason I´m making a MySound class is because in MySound class I have methods that pauses and resumes the current sound object.

      I know I can make it directly through script with Sound class, but with MySound class it gets better to write script to work with sounds.

       

      So I can just use s1.pause() s1.resume(), instead of creating a variable each time for each sound object.

       

      Any help?

       

       

      Thanks