1 Reply Latest reply on Sep 5, 2010 7:45 PM by kglad

    Code required to disable flash for non flash users

    cameron-ac

      Hi I am very new to flash and require some code that enables users who do not have flash the ability to view an image instead of the swf movie clip.

       

      My code is as follows:

       


      <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="450" height="279">
              <param name="movie" value="../flash/wwd2.swf" />
              <param name="quality" value="high" />
              <embed src="../flash/wwd2.swf" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="450" height="279" ></embed>
            </object>

       

      I am using actionscript 2, with the following actionscript:

       

      1. // All time in milliseconds. (1000 = 1 second)
      2. maxTB = 4000; // Maximum time between flickering
      3. minTB = 1000; // Minimum time between flickering
      4. flickerDuration = 2000; // How long flicker will last
      5. // Get a random start time.
      6. flickerTime = getNewTime();
      7. // Every frame execute the following code.
      8. this.onEnterFrame = function(){
      9. // Get current time in milliseconds.
      10. curTime = getTimer();
      11. // Check if current time is past the time to flicker.
      12. if(curTime >= flickerTime){
      13. // Flickering.
      14. // Check if flicker has lasted the duration specified.
      15. if(curTime <= flickerTime+flickerDuration){
      16. // Continue flickering.
      17. // Alternate between alpha values.
      18. // This creates the flicker appearance.
      19. if( cnt >= 2){
      20. // Reduce alpha.
      21. // Lower this for more dramatic effect.
      22. this._alpha = 90;
      23. cnt = 0;
      24. } else {
      25. // Increase alpha.
      26. this._alpha = 100;
      27. cnt++;
      28. }
      29. } else {
      30. // Flicker lasted for duration.
      31. // Stop flickering and get next time to flicker.
      32. this._alpha = 100;
      33. flickerTime = getNewTime();
      34. }
      35. }
      36. }
      37. // Create a random time between maxTB and minTB specified.
      38. function getNewTime(){
      39. return getTimer() + (Math.random() * (maxTB-minTB))+minTB;

       

       

       

      I would really appreciate any help on this as I have searched on Google for hours and cannot find anything that I am able to understand. Thank you.

       

      Andrew