5 Replies Latest reply on Apr 13, 2008 7:12 AM by kglad

    key pressing

    gwklam
      i can't use onkeypress, so , how do i detect numbers with key.isDown() ?
        • 1. Re: key pressing
          kglad Adobe Community Professional & MVP
          you can use a setInterval or onEnterFrame looop to repeatedly check if a number key is depressed.
          • 2. Re: key pressing
            gwklam Level 1
            what i mean, is how can i detect the key '2'? or any other number
            • 3. Re: key pressing
              kglad Adobe Community Professional & MVP
              use a key listener or a loop.
              • 4. key pressing
                gwklam Level 1
                thanks kglad. I think you might know how to answer this too, how do i preload the first frame of an external swf? only the first frame.

                Unless you can optimize this code below so it wouldn't look like i'm loading the same thing twice. and it wouldn't look right if i put the preloader in the external swf.



                function timeintro() {
                preloadingbar._visible = true;
                preloadingbar._xscale=0;
                preloaderload._visible = true;
                lv = new LoadVars();
                lv.onLoad = function(detects){
                if(detects){
                loadMovie(" http://silentsleeper.com/blahblah.swf", "windowsmusicmain");
                }else{
                musicfind="Failed to detect Internet"
                }
                }
                onEnterFrame = function () {
                byteTotal = lv.getBytesTotal();
                byteLoaded = lv.getBytesLoaded();
                percentageloaded = (lv.getBytesLoaded()/lv.getBytesTotal())*100;
                preloadingbar._xscale = percentageloaded;
                preloaderload.text = int(percentageloaded)+"%";
                if (percentageloaded==100) {
                delete onEnterFrame;
                preloadingbar._visible = false;
                preloaderload._visible = false;
                }
                }
                lv.load(" http://silentsleeper.com/blahblah.swf");
                }
                timeintro();
                • 5. Re: key pressing
                  kglad Adobe Community Professional & MVP
                  you can use the _framesloaded property (instead of its getBytesLoaded() method) of windowmusicmain to preload its first frame.