hi guys - really hope you can help with this one

i've got the following class assigned to a movieclip (using linkage)

[code]
import com.receptacledesign.events.EventClip
import mx.utils.Delegate;

class com.avatar extends EventClip // adds events to the movieclip
{
        
        var _nc:NetConnection;
        var _ns:NetStream;
        var _mp3:String;
        
        var player:MovieClip;
        var avatarStatic:MovieClip;
        
        // constructor
        public function avatar()
        {
                init();
        }
        
        private function init():Void
        {
                trace(this + " is here. v0.2"); // outputs correctly
player = this.attachMovie("mcVideo", "player", this.getNextHighestDepth());
        }
        
        public function mouthControl(mouthMode:String):Void
        {
                trace("mouthControl"); // doesn't trace :(
                switch (mouthMode)
                {
                        case "start" :
                                trace("startMouth");
                                startMouth();
                        break;
                        
                        case "stop" :
                                trace("stopMouth");
                                stopMouth();
                        break;
                        
                        default :
                                trace("mouthMode not recognised");
                }
        }
        
        public function testavatar():Void // doesn't fire :(
        {
                trace("avatar is testing");
        }
        
        // private methods -
        private function startMouth():Void
        {
                trace("startMouth()");

                _nc = new NetConnection();
                _nc.connect(null);
                _ns = new NetStream(_nc);
                player.attachVideo(_ns);
                _ns.play("mp3:" + MP3);
                _ns.onStatus = Delegate.create(this, nsOnStatus);

                lexStatic.gotoAndPlay("on");
        }
        
        private function stopMouth():Void
        {
                trace("stopMouth()");
        }
        
        private function fireEvent(evt:String):Void
        {
                if (evt != "outro") gotoAndStop("static");
                dispatchEvent({target:this, value:evt, 
type:EventClip.FINISHED});
        }
        
        private function nsOnStatus(evt:Object):Void
        {
                trace(evt.code);
                if (evt.code == "NetStream.Buffer.Flush") stopMouth();
        }
        
        // getters and setters
        public function set MP3(s:String):Void
        {
                _mp3 = s;
        }
        public function get MP3():String
        {
                return _mp3;
        }
}
[/code]

and i'm trying to do the following

set the mp3 file path with the setter mp3
run the mouthControl() method

so i've done this in my main class:
        private var avatar:MovieClip; // set on initialisation

        private function avatarSayWord():Void
        {
                avatar.MP3 = Questions[nCurrentQuestion].media;
trace("Game.avatarSayWord: " + avatar.MP3); // traces path to mp3 file correctly from avatar
                avatar.mouthControl("start"); // does nothing
                avatar.testavatar(); // does nothing
        }


the setter and the getter is working but the public methods aren't working at all

what am i doing wrong please?

please help - it's crunch time here

thankyou
alz



_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to