Current location: Hot Scripts Forums » General Web Coding » JavaScript » load swf with javascript


load swf with javascript

Reply
  #1 (permalink)  
Old 04-10-06, 03:53 AM
crmpicco's Avatar
crmpicco crmpicco is offline
Wannabe Coder
 
Join Date: Jan 2005
Posts: 124
Thanks: 0
Thanked 0 Times in 0 Posts
load swf with javascript

Code:
function animateText(id,iStart,iCurrent,iDir) 
{
	var obj = document.getElementById(id);
    if(typeof(iStart)=="undefined") 
	{
    	iStart = 0;
    	iCurrent = iStart;
    	iDir = +2; // Increasing Value also increases speed
    }
    if(iDir > 0 && iCurrent > obj.parentNode.offsetHeight) 
	{
		/*
		obj.innerHTML = "<img border='0' src='/v2/asp/images/picco.gif' style='visibility: hidden' />";
		obj.innerHTML = obj.innerHTML + "empowered by Picco &copy;";
		*/
		obj.innerHTML = "<OBJECT codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0' WIDTH='200' HEIGHT='100' id='picco'><EMBED src='picco.swf' bgcolor='#333399' WIDTH='200' HEIGHT='100' NAME='volaro' TYPE='application/x-shockwave-flash' PLUGINSPAGE='http://www.macromedia.com/go/getflashplayer'></EMBED></OBJECT>";
		//obj.innerHTML = "<img border='0' src='picco.swf' />";
    	iDir = -2; // Increasing Value also increases speed (must match the speed above)
    }
    iCurrent += iDir;
    obj.style.top = iCurrent + "px";
	var iSpeed = 15; // The Speed at which the image scrolls down and the text scrolls up (smaller = faster)
	
    if(iCurrent!=iStart) 
	{
    	window.setTimeout(function() { animateText(id, iStart, iCurrent, iDir) }, iSpeed);
    }
}

// If the Client's browser is MSIE then proceed with the functions to show/hide image	
if (browser.isIE)
{
	window.onload = function() 
	{
		var iWait = 1000; // How many seconds to wait after page loads to hide the image
		window.setTimeout(function() { animateText('scrollHead') }, iWait); 
		return true;
	};
}
I am trying to load this 'object' which is a flash file (picco.swf) from my javascript into a <td> cell using innerHTML. Is this possible, as it does not seem to work at the moment.

The code in question is:
Code:
obj.innerHTML = "<OBJECT codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0' WIDTH='200' HEIGHT='100' id='picco'><EMBED src='picco.swf' bgcolor='#333399' WIDTH='200' HEIGHT='100' NAME='volaro' TYPE='application/x-shockwave-flash' PLUGINSPAGE='http://www.macromedia.com/go/getflashplayer'></EMBED></OBJECT>";

This code works, when coded into the cell, but I am looking to have it appear from below and gradually go to the top as it did previously with the text 'empowered by Picco'.....

Code:
<td align="right" valign="top">
	<div style="position: relative; z-index: -20;">
		<span id="scrollHead" class="div_Header_Pos">
			<OBJECT codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" 
			WIDTH="200" HEIGHT="100" id="volaro">
				<EMBED src="volaro.swf" bgcolor=#333399 WIDTH="200" HEIGHT="100" NAME="volaro" TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"></EMBED> 
			</OBJECT>							
		</span>
	</div>
</td>
Reply With Quote
  #2 (permalink)  
Old 04-14-06, 06:52 AM
TwoD TwoD is offline
Community VIP
 
Join Date: Sep 2003
Location: 404
Posts: 1,813
Thanks: 0
Thanked 0 Times in 0 Posts
I'm not sure what might be wrong here. Do you have a demo page online which demonstrates the problem?
It's best to have the whole source when debugging, just to make sure everything's ok.
__________________
[W3Schools - learn all about the standards.] [QuirksMode - Browser Quirks] [MS's Online Reference Docs] [DOM in Gecko.]
Please pay attention to stickys, announcements and forum rules, thank you.
Please also remember Code Wrappers and [SOLVED] Marking, this helps everyone.
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Add javascript after load? <?Wille?> JavaScript 14 03-31-06 04:52 AM
javascript /forms /checkboxes /arrays ski_woman JavaScript 1 11-16-04 04:08 AM
Order of vbscript and javascript in ASP marlin ASP 0 06-03-04 03:01 PM
JavaScript to load Applet Letsplaycardspartner JavaScript 1 04-15-04 09:20 AM
Reaaly stuck about javascript over frames muratisik JavaScript 1 12-14-03 11:58 AM


All times are GMT -5. The time now is 11:08 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.