jQuery版 SWFObject

jQuery版 SWFObject
http://jquery.thewikies.com/swfobject/

▼例
http://jquery.thewikies.com/swfobject/example_myFlash.html

```
<script src="http://code.jquery.com/jquery-1.4.2.min.js"></script>
<script src="http://jquery.thewikies.com/swfobject/jquery.swfobject.1-1-1.min.js"></script>

<script>
$(document).ready(
	function() {
		$('#myFlash').flash('fireworks.swf');
	}
);
</script>

<div id="myFlash">
	The &quot;You don't have flash&quot; message.
	Or any other backup content.
</div>
```


▼FlashVars 使用時
http://jquery.thewikies.com/swfobject/example_myFlashVars.html

```
<script>
$(document).ready(
	function () {
		// #myFlashVars is the selector
		$('#myFlashVars').flash(
			{
				// test_flashvars.swf is the flash document
				swf: 'test_flashvars.swf',
				// these arguments will be passed into the flash document
				flashvars: {
					name1: 'jQuery',
					name2: 'SWFObject',
					name3: 'Plugin'
				}
			}
		);
	}
);
</script>

<div id="myFlashVars"></div>
```


▼JavaScript / Flash 連携
http://jquery.thewikies.com/swfobject/example_flashInteract.html

```
<script>
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');
		}
	);
}
</script>

<div id="flashInteract">
	<div class="movie"></div>

	<p style="font-family: arial;">
		<input type="button" onclick="firstFrame();" value="<<" />
		<input type="button" onclick="prevFrame();" value="<" />
		<input type="button" onclick="play();" value="PLAY" />
		<input type="button" onclick="pause();" value="PAUSE" />
		<input type="button" onclick="nextFrame();" value=">" />
		<input type="button" onclick="lastFrame();" value=">>" />
	</p>

	<p>
		<input type="text" value="I come from javascript." size="20" onfocus="this.select();" id="data" /> 
		<input type="button" onclick="sendToFlash();" value="Send to Flash" />
		<input type="button" onclick="getFromFlash();" value="Get from Flash" />
	</p>
</div>
```

以下より引用
http://jquery.thewikies.com/swfobject/examples