HTML -> SWF
SWF -> HTML
In this movieClip, the flash buttons will show if the variable showButton is true
Install via Bower
$ bower install swf-jquery --save
Examples:
Simple Load
<div id="example1"></div>
<script>
$('#example1').flash('assets/exampleFlash.swf')
</script>
With Parameters
<div id="example2"></div>
<script>
$('#example2').flash({
swf:'assets/exampleFlash.swf',
width:320,
height:250,
allowFullScreen: true,
id:'flashPlayer_example2',
wmode:"transparent",
flashvars: {
txt: 'Hello World',
foo: 'bar'
}
});
</script>
Functions
Flash:
<div id="example3"></div>
HTML:<br>
<div class="btn-sample3" id="btnSample3_left">creatureMove("left")</div>
<div class="btn-sample3" id="btnSample3_right">creatureMove("right")</div>
<script>
$('#example3').flash({
swf:'assets/exampleFlash.swf',
width:320,
height:250,
allowFullScreen: true,
id:'flashPlayer_example3', // setup id to call SWF
wmode:"transparent",
flashvars: {
showButton: true
}
});
window.changeColor = function(str){
$('.btn-sample3').removeClass('red').removeClass('blue').addClass(str);
}
$('#btnSample3_left').click(function(){
$("#flashPlayer_example3")[0].creatureMove('left'); // [0] because jQuery return array
});
$('#btnSample3_right').click(function(){
$("#flashPlayer_example3")[0].creatureMove('right');
});
</script>
Flash:
HTML:creatureMove("left")
creatureMove("right")