본문 바로가기

WEB/Javascipt

jQuery SWFObject Plugin


참조 : http://jquery.thewikies.com/swfobject/
예제 : http://jquery.thewikies.com/swfobject/examples

1. 플러그인 인클루드 빼먹지 말자



2. 통합 예제 js 소스

flashMovie = null;

$(document).ready(
	function () {
		flashMovie = $('#flashInteract .movie');

		flashMovie.flash(
			{
				swf: 'javascript-flash-interaction.swf',
				width: 481,
				height: 86,
				play: false,
				flashvars: {
					message: 'I come from Flash.'
				},
			}
		);
	}
);

function play() {
	flashMovie.flash(
		function() {
			this.Play();
		}
	);
}

function pause() {
	flashMovie.flash(
		function() {
			this.StopPlay();
		}
	);
}

function firstFrame() {
	flashMovie.flash(
		function() {
			this.GotoFrame(0);
		}
	);
}

function lastFrame() {
	flashMovie.flash(
		function() {
			this.GotoFrame(9);
		}
	);
}

function prevFrame() {
	flashMovie.flash(
		function() {
			var currentFrame = this.TGetProperty('/', 4),
				previousFrame = parseInt(currentFrame) - 2;

			if (previousFrame < 0) {
				previousFrame = 9;
			}

			this.GotoFrame(previousFrame);
		}
	);
}

function nextFrame() {
	flashMovie.flash(
		function() {
			var currentFrame = this.TGetProperty('/', 4),
				nextFrame = parseInt(currentFrame);

			if (nextFrame >= 10) {
				nextFrame = 0;
			}

			this.GotoFrame(nextFrame);
		}
	);
}

function sendToFlash() {
	flashMovie.flash(
		function() {
			this.SetVariable('/:message', document.getElementById('data').value);
		}
	);
}

function getFromFlash() {
	flashMovie.flash(
		function() {
			document.getElementById('data').value = this.GetVariable('/:message');
		}
	);
}

---------------------------

 
반응형

'WEB > Javascipt' 카테고리의 다른 글

jquery 충돌방지  (0) 2011.11.02
jQuery Form check - 제이쿼리 폼체크  (0) 2011.10.05
jquery slide toggle , 네비게이션 슬라이드 토글 ,  (0) 2011.08.25