FlashからFlashレイヤーを作成して表示する。


http://moeten.info/flex/20091002_asjs/bin-release/main.html
FlashからFlashをオーバーレイ表示させます。
オーバーレイ部分はむらけんさのところを拝借。そしてデバッグが大変なので、jsのメイン部分のみを抜き出して使用。
ActionScript部分に直接JSを記入してます。こういうこともできるんだなぁって知っておくと便利かも?ホント?

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" width="288" height="154" backgroundGradientAlphas="[1.0, 1.0]" backgroundGradientColors="[#E3E3E3, #6F6F6F]">
<mx:Script>
<![CDATA[
private var callJasFunction:String = "document.insertScript = "+
" function(){                                             "+
    " showFlash = function(file){                          "+
        " var objBody    = document.body;                  "+
        " var objOverlay = document.createElement('div');  "+
        " var myTag= '<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=10\" width=\"100%\" height=\"100%\" id=\"overlayFlash\" align=\"middle\"><param name=\"allowScriptAccess\" value=\"sameDomain\" /><param name=\"movie\" value=\"'+file+'\" /><param name=\"quality\" value=\"high\" /><param name=\"salign\" value=\"lt\" /><param name=\"wmode\" value=\"transparent\" /><param name=\"bgcolor\" value=\"#ffffff\" /><embed src=\"'+file+'\" quality=\"high\" salign=\"lt\" swLiveConnect=true wmode=\"transparent\" bgcolor=\"#ffffff\" width=\"100%\" height=\"100%\" name=\"overlayFlash\" id=\"overlayFlash\" align=\"middle\" allowScriptAccess=\"sameDomain\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" /></object>'; "+
        " objOverlay.setAttribute('id','myoverlay');   "+
        " objOverlay.style.display  = 'block';         "+
        " objOverlay.style.position = 'absolute';      "+
        " objOverlay.style.top      = '0';             "+
        " objOverlay.style.left     = '0';             "+
        " objOverlay.style.zIndex   = '999';           "+
         " objOverlay.style.width    = '100%';          "+
        " objOverlay.style.height   = '100%';          "+
        " objOverlay.style.border   = 'solid 1px red'; "+
        " objOverlay.style.display  = 'block';         "+
        " objOverlay.innerHTML      = myTag;           "+
        " objOverlay.onclick = function(){ hideFlash(); return false;}; "+
        " objBody.insertBefore(objOverlay, objBody.firstChild);         "+
    " }; "+
    " hideFlash = function(){                      "+
        " var objBody = document.body;             "+
        " objBody.removeChild(objBody.firstChild); "+
    "};                                            "+
" } ";
private function onClick():void{
    ExternalInterface.call(callJasFunction);
    ExternalInterface.call("showFlash", "imageShowBig.swf");
}
]]>
</mx:Script>
<mx:TextArea verticalScrollPolicy="off" x="0" y="0" backgroundAlpha="0" alpha="0.1" color="0x999999" width="288" height="154" text="This is Flash.This is Flash.This is Flash.This is Flash.This is Flash.This is Flash.This is Flash.This is Flash.This is Flash.This is Flash.This is Flash.This is Flash.This is Flash.This is Flash.This is Flash.This is Flash.This is Flash.This is Flash.This is Flash.This is Flash.This is Flash.This is Flash.This is Flash.This is Flash.This is Flash.This is Flash.This is Flash.This is Flash.This is Flash.This is Flash.This is Flash.This is Flash.This is Flash.This is Flash.This is Flash.This is Flash.This is Flash.This is Flash.This is Flash.This is Flash.This is Flash." fontSize="20"/>
<mx:Button click="onClick()" label="HTMLの上にFlashを作成する by Flash " x="34" y="75" height="36"/>
</mx:Application>

眠い・・・・