Page 1 of 2 12 LastLast
Results 1 to 10 of 15

Thread: Adding mouse trailer in cs4

  1. #1
    Join Date
    Nov 2010
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Adding mouse trailer in cs4

    How do you add a mouse trailer in Flash CS4?

  2. #2
    Join Date
    Nov 2010
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Mouse Trailer

    The code works but it displays in the background. Here's my code below.

    Code:
    <html>
    <head>
    <title>Mouse Test Trailer</title>
    <style>
    .spanstyle {
    	position:absolute;
    	visibility:visible;
    	top:-50px;
    	font-size:10pt;
    	font-family:Verdana;
          font-weight:bold;
    	color:black;
    }
    </style>
    <script>
    
    /*
    Cursor Trailor Text
    */
    
    var x,y
    var step=20
    var flag=0
    
    // Your message. Important: the space at the end of the sentence!!!
    var message="Indian Queen Elementary School! "
    message=message.split("")
    
    var xpos=new Array()
    for (i=0;i<=message.length-1;i++) {
    	xpos[i]=-50
    }
    
    var ypos=new Array()
    for (i=0;i<=message.length-1;i++) {
    	ypos[i]=-50
    }
    
    function handlerMM(e){
    	x = (document.layers) ? e.pageX : document.body.scrollLeft+event.clientX
    	y = (document.layers) ? e.pageY : document.body.scrollTop+event.clientY
    	flag=1
    }
    
    function makesnake() {
    	if (flag==1 && document.all) {
        	for (i=message.length-1; i>=1; i--) {
       			xpos[i]=xpos[i-1]+step
    			ypos[i]=ypos[i-1]
        	}
    		xpos[0]=x+step
    		ypos[0]=y
    	
    		for (i=0; i<message.length-1; i++) {
        		var thisspan = eval("span"+(i)+".style")
        		thisspan.posLeft=xpos[i]
    			thisspan.posTop=ypos[i]
        	}
    	}
    	
    	else if (flag==1 && document.layers) {
        	for (i=message.length-1; i>=1; i--) {
       			xpos[i]=xpos[i-1]+step
    			ypos[i]=ypos[i-1]
        	}
    		xpos[0]=x+step
    		ypos[0]=y
    	
    		for (i=0; i<message.length-1; i++) {
        		var thisspan = eval("document.span"+i)
        		thisspan.left=xpos[i]
    			thisspan.top=ypos[i]
        	}
    	}
    		var timer=setTimeout("makesnake()",30)
    }
    
    </script>
    </head>
    <body  onLoad="makesnake()" style="width:100%;overflow-x:hidden;overflow-y:scroll">
    <script>
    <!-- Beginning of JavaScript -
    
    for (i=0;i<=message.length-1;i++) {
        document.write("<span id='span"+i+"' class='spanstyle'>")
    	document.write(message[i])
        document.write("</span>")
    }
    
    if (document.layers){
    	document.captureEvents(Event.MOUSEMOVE);
    }
    document.onmousemove = handlerMM;
    
    // - End of JavaScript - -->
    </script>
    </body>
    </html>
    The rest of the html file loads a Flash movie and when you move the mouse you can only see it behind the flash movie.

    Thank you
    Last edited by jscheuer1; 11-16-2010 at 04:10 PM. Reason: format code

  3. #3
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Follow the below advice, it's the best you can do without recompiling the .swf, which is usually not required. But be aware that when the mouse is over the Flash object, the Flash object may still take control of the mouse cursor. But at least when the mouse isn't over the Flash object, the trailer effect should show over the Flash object. Some Flash objects will not even allow this, but most do.

    Loosely from:

    http://www.macromedia.com/cfusion/kn...fm?id=tn_14201

    Add in this language to your object/embed tag(s) -

    Add the following parameter to the OBJECT tag:

    HTML Code:
    <param name="wmode" value="transparent">
    Add the following attribute to the EMBED tag:

    Code:
    wmode="transparent"
    Or, if you are using two object tags, as can and is sometimes done, add the param tag to both of them.

    If you are using script to generate the tags, the wmode transparent must be passed to the script. This is easily accomplished but, varies depending upon the sort of script one uses. Some scripts do it automatically.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  4. #4
    Join Date
    Nov 2010
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thank you for your response, however the trailer is still being displayed behind the flash object.

  5. #5
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Please post a link to a page on your site that contains the problematic code so we can check it out.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  6. #6
    Join Date
    Nov 2010
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Mouse Trailer

    Here's the link

    "http://www.soaring-technologies.com/indianqueen/test6.html"

  7. #7
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Change this (highlighted as shown):

    Code:
    <script language="JavaScript" type="text/javascript">
    	AC_FL_RunContent(
    		'codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=10,0,0,0',
    		'width', '850',
    		'height', '1200',
    		'src', 'iqes',
    		'quality', 'high',
    		'pluginspage', 'http://www.adobe.com/go/getflashplayer',
    		'align', 'middle',
    		'play', 'true',
    		'loop', 'true',
    		'scale', 'showall',
    		'wmode', 'transparent',
    		'devicefont', 'false',
    		'id', 'iqes',
    		'bgcolor', '#ffffff',
    		'name', 'iqes',
    		'menu', 'true',
    		'allowFullScreen', 'false',
    		'allowScriptAccess','sameDomain',
    		'movie', 'iqes',
    		'salign', ''
    		); //end AC code
    </script>
    Oh, and if you want this to work in other browsers besides IE, use this version of the trailer script:

    Code:
    <script>
    
    /*
    Cursor Trailor Text
    */
    
    var x,y
    var step=20
    var flag=0
    
    // Your message. Important: the space at the end of the sentence!!!
    var message="Indian Queen Elementary School! "
    message=message.split("")
    
    var xpos=new Array()
    for (i=0;i<=message.length-1;i++) {
    	xpos[i]=-50
    }
    
    var ypos=new Array()
    for (i=0;i<=message.length-1;i++) {
    	ypos[i]=-50
    }
    
    function handlerMM(e){
    	e = e || event;
    	x = typeof e.pageX === 'number'? e.pageX : document.body.scrollLeft+event.clientX
    	y = typeof e.pageY === 'number'? e.pageY : document.body.scrollTop+event.clientY
    	flag=1
    }
    
    function makesnake() {
    	if (flag==1 && document.all) {
        	for (i=message.length-1; i>=1; i--) {
       			xpos[i]=xpos[i-1]+step
    			ypos[i]=ypos[i-1]
        	}
    		xpos[0]=x+step
    		ypos[0]=y
    	
    		for (i=0; i<message.length-1; i++) {
        		var thisspan = eval("span"+(i)+".style")
        		thisspan.posLeft=xpos[i]
    			thisspan.posTop=ypos[i]
        	}
    	}
    	
    	else if (flag==1 && document.layers) {
        	for (i=message.length-1; i>=1; i--) {
       			xpos[i]=xpos[i-1]+step
    			ypos[i]=ypos[i-1]
        	}
    		xpos[0]=x+step
    		ypos[0]=y
    	
    		for (i=0; i<message.length-1; i++) {
        		var thisspan = eval("document.span"+i)
        		thisspan.left=xpos[i]
    			thisspan.top=ypos[i]
        	}
    	}
    
    	else if (flag==1 && document.getElementById) {
        	for (i=message.length-1; i>=1; i--) {
       			xpos[i]=xpos[i-1]+step
    			ypos[i]=ypos[i-1]
        	}
    		xpos[0]=x+step
    		ypos[0]=y
    	
    		for (i=0; i<message.length-1; i++) {
        		var thisspan = document.getElementById('span' + i).style;
        		thisspan.left=xpos[i]+'px';
    			thisspan.top=ypos[i]+'px'
        	}
    	}
    		var timer=setTimeout("makesnake()",30)
    }
    
    </script>
    Last edited by jscheuer1; 11-17-2010 at 06:52 PM. Reason: add x browser trailer
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  8. #8
    Join Date
    Nov 2010
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    When I change wmode to "transparent" the only thing you see is the mouse trailer and nothing else.

  9. #9
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  10. #10
    Join Date
    Nov 2010
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    I'm not sure what's going on but it's still not working. When I move the mouse over the flash object the object begins to wipe itself out. Do you have any links on creating text mouse trailer inside of Flash?

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
  •