SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Addict
    Join Date
    Jul 2008
    Posts
    288
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question >Trigger above frame 10 with js?

    I'm putting together something where the flash animation is triggered outside of flash. I am looking for certain images (outside of flash) to trigger certain frames but currently can only get it to jump to frames below 10 for some reason. If anyone can tell me why and how I get around this I will be truly grateful. And please be gentle - it might look like I know what I'm doing but I've still got my L-plates on.

    Here is a test page:
    http://www.webvertising4free.com/MFPOI/FlashTEST.html

    As you can see we have the 'play' which starts the animation from wherever it currently is, 'play frame 5' which jumps to frame 5 and starts playing and 'play frame 11' which just doesn't work even though I have used the same form of coding.

    Here is the JS file:

    movie1.js
    Code JavaScript:
    function RunMovie()
    {
       document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"  codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" id="FrameCount" width="400"  height="550">\n');
       document.write('<param name="FrameCount" value="FrameCount.swf">\n');
       document.write('<param name="quality" value="high">\n');
       document.write('<param name="wmode" value="transparent">\n');
       document.write('<embed type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" name="FrameCount" width="400" height="550" src="FrameCount.swf" quality="high" wmode="transparent" swliveconnect="true" allowscriptaccess="samedomain"></embed>\n');
       document.write('</object>\n');
    }
     
    function getFlashMovieObject(FrameCount)
    {
      if (window.document[FrameCount]) 
      {
        return window.document[FrameCount];
      }
      if (navigator.appName.indexOf("Microsoft Internet")==-1)
      {
        if (document.embeds && document.embeds[FrameCount])
          return document.embeds[FrameCount]; 
      }
      else // if (navigator.appName.indexOf("Microsoft Internet")!=-1)
      {
        return document.getElementById(FrameCount);
      }
    }
     
    function PlayFlashMovie()
    {
    	var flashMovie=getFlashMovieObject("FrameCount");
    	flashMovie.Play();
    }
     
    function Frame5FlashMovie()
    {
    	var flashMovie=getFlashMovieObject("FrameCount");
    	// 4 is the index of the property for _currentFrame
    	var currentFrame=flashMovie.TGetProperty("/", 4);
    	var Frame5=parseInt(currentFrame);
    	if (Frame5>=1)
    		Frame5=5;
    	flashMovie.GotoFrame(Frame5);
    	flashMovie.Play();
    }
     
    function Frame11FlashMovie()
    {
    	var flashMovie=getFlashMovieObject("FrameCount");
    	// 10 is the index of the property for _currentFrame
    	var currentFrame=flashMovie.TGetProperty("/", 10);
    	var Frame11=parseInt(currentFrame);
    	if (Frame11>=1)
    		Frame11=11;
    	flashMovie.GotoFrame(Frame11);
    	flashMovie.Play();
    }

  2. #2
    SitePoint Guru
    Join Date
    Sep 2006
    Posts
    731
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by g_force View Post

    Here is the JS file:

    movie1.js
    That's not the same as the code on the site. The error console is indicating 'A is not defined'. If you want to use hex notation it should be 0xA.
    Tab-indentation is a crime against humanity.

  3. #3
    SitePoint Addict
    Join Date
    Jul 2008
    Posts
    288
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    yes hex is what I was trying (I left that on the test page by mistake) - I believe it is the fix but what is the sequence however so far none of it is working using a variation of this:


    Code JavaScript:
    function Frame11FlashMovie()
    {
    	var flashMovie=getFlashMovieObject("FrameCount");
    	// 10 is the index of the property for _currentFrame
    	var currentFrame=flashMovie.TGetProperty("/", 0xA);
    	var Frame11=parseInt(currentFrame);
    	if (Frame11>=1)
    		Frame11=0xA;
    	flashMovie.GotoFrame(Frame11);
    	flashMovie.Play();
    }

    what would be the correct way?


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •