Webãã¼ã¸ãã£ããã£ã¼ãªAIRãªã¢ããªãä½ã£ããï¼¼(ããï¼¼)(ï¼ãã)ï¼
ã¡ãã£ã¨æ軽ã«ï¼·ï½
ï½ãã¼ã¸ããã£ããã£ã¼ãããã¯ãªãããã¼ãã®ç»åããã£ããã£ã¼ãããã§ããAIRãªã¢ããªãä½ã£ã¦ã¿ã¾ããã
é¨åä¿åã対å¿ãã¦ãã¾ãã
ã試ãã¯ãã¡ããã
åä½ã ã¼ãã¼ã¯ãã¡ã
ã¯ãªãããã¼ãããç»åãåãåºãæ¹æ³
var g:Clipboard = Clipboard.generalClipboard; //ç»åãããªãå ´åã¯ã¨ã©ã¼ if( !g.hasFormat( ClipboardFormats.BITMAP_FORMAT)){ mx.controls.Alert.show("ã¯ãªãããã¼ãã«ç»åããªããï¼"); } //ç»åã®æç» var bd2:BitmapData; bd2 = g.getData( ClipboardFormats.BITMAP_FORMAT ) as BitmapData; myImage2.source = new Bitmap( bd2 );
ããããã¨ãã°ããã§ããããããã£ãã¢ããªãã§ããã£ã¦ãã¨ã§ã
ã½ã¼ã¹ã³ã¼ãã¯ãã¡ã
<?xml version="1.0" encoding="utf-8"?> <mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="init()" xmlns:local="*" backgroundAlpha="1" backgroundColor="0xffccff" width="884" height="900" xmlns:objecthandles="com.roguedevelopment.objecthandles.*" viewSourceURL="srcview/index.html"> <mx:Script> <![CDATA[ import mx.controls.Alert; import mx.graphics.codec.PNGEncoder; //ç»åä¿åç¨ private var bd:BitmapData; //åæåé¢æ° private function init():void{ } //ãã¼ã¸ä¸¸ãã¨ä¿å private function getPage():void{ var w:int; var h:int; if( radiogroup1.selectedValue == "0" ){ //ï¼·ï½ ï½ç»åãä¿å w = int(myHtmlW.text); h = int(myHtmlH.text); bd = new BitmapData( w , h ); bd.draw( myHtml ); }else{ //ã¯ãªããç»åãä¿å w = myImage2.width; h = myImage2.height; bd = new BitmapData( w , h ); bd.draw( myImage2 ); } //æ¸ãåºãç¨ç»å表示 myImage.source = new Bitmap( bd ); //ä¿åãã¿ã³æå¹ mySaveBtn.enabled = true; finishTxt.visible = false; } //é¨åä¿å private function getCap():void{ //ç»åç¨æ var w:int = myTest.width; var h:int = myTest.height; bd = new BitmapData( w , h ); //é¨åç»åãªã®ã§å ´æããµã¤ãºãå©ç¨ var rec:Rectangle = new Rectangle(); rec.width = w; rec.height = h; var mat:Matrix = new Matrix(); mat.tx = -myTest.x; mat.ty = -myTest.y; // mat.scale(mySlider.value,mySlider.value); // mat.a = mySlider.value; // mat.d = mySlider.value; if( radiogroup1.selectedValue == "0" ){ //ï¼·ï½ ï½ç»åãä¿å bd.draw( myHtml , mat , null , null , rec ); }else{ //ã¯ãªããç»åãä¿å bd.draw( myImage2 , mat , null , null , rec ); } //æ¸ãåºãç¨ç»å表示 myImage.source = new Bitmap( bd ); //ä¿åãã¿ã³æå¹ mySaveBtn.enabled = true; finishTxt.visible = false; } //ç»åããã£ã«ä¿å private function saveImage():void{ //ãã¡ã¤ã«åã決ãã var fname:String = new String(); var d:Date = new Date(); fname = "" + d.getFullYear() + "å¹´"+(d.getMonth()+1) + "æ"+d.getDay()+"æ¥"+d.getHours() +"æ"+ d.getMinutes() + "å" + d.getSeconds() + "ç§.png"; //ãã¡ã¤ã«ä¿å var png:PNGEncoder = new PNGEncoder(); var bta:ByteArray = png.encode(bd); var save_file:File = File.desktopDirectory; save_file = save_file.resolvePath(fname); var fs:FileStream = new FileStream(); fs.open(save_file,FileMode.UPDATE); fs.writeBytes(bta, 0, bta.length); fs.close(); //ä¿åãããã®ã§ä¿åãã¿ã³ç¡å¹ mySaveBtn.enabled = false; finishTxt.visible = true; } //ã¯ãªãããã¼ãããç»åãã²ãã private function getClipbord():void{ var g:Clipboard = Clipboard.generalClipboard; //ç»åãããªãå ´åã¯ã¨ã©ã¼ if( !g.hasFormat( ClipboardFormats.BITMAP_FORMAT)){ mx.controls.Alert.show("ã¯ãªãããã¼ãã«ç»åããªããï¼"); } //ç»åã®æç» var bd2:BitmapData; bd2 = g.getData( ClipboardFormats.BITMAP_FORMAT ) as BitmapData; myImage2.source = new Bitmap( bd2 ); } ]]> </mx:Script> <mx:Style> ApplicationControlBar { highlightAlphas: 1, 0.3; fillAlphas: 0.64, 0.24; fillColors: #ffffff, #cc00ff; backgroundAlpha: 0.67; cornerRadius: 5; dropShadowEnabled: true; shadowDistance: 1; } </mx:Style> <!--åå¾ç»å表示--> <mx:Label x="10" y="202" text="{radiogroup1.selection.label}" fontSize="20"/> <mx:Button x="83" y="207" label="â" click="{myHtml.historyBack()}" visible="{!Boolean(radiogroup1.selectedValue)}"/> <mx:Button x="131" y="207" label="â" click="{myHtml.historyForward()}" visible="{!Boolean(radiogroup1.selectedValue)}"/> <mx:Image id="myImage2" x="10" y="241" visible="{Boolean(radiogroup1.selectedValue)}" /> <mx:Canvas x="10" y="241" height="{int(myHtmlH.text)}" width="{int(myHtmlW.text)}"> <mx:HTML id="myHtml" x="2.5" y="1" width="100%" height="100%" visible="{!Boolean(radiogroup1.selectedValue)}" verticalScrollPolicy="off" horizontalScrollPolicy="off"/> <objecthandles:ObjectHandles id="myTest" allowHResize="false" allowVResize="false" allowHMove="true" borderStyle="solid" borderThickness="2" borderColor="0xff0000" height="{int(myTestH.text)}" width="{int(myTestW.text)}" visible="{myTestV.selected}"> <mx:Canvas backgroundColor="0xff0000" alpha="0.3" width="100%" height="100%" /> </objecthandles:ObjectHandles> </mx:Canvas> <!--ç»åå ãªãã·ã§ã³--> <mx:RadioButtonGroup id="radiogroup1"/> <mx:ViewStack x="11" y="48" id="viewstack1" width="378" height="150" selectedIndex="{int(radiogroup1.selectedValue)}" backgroundColor="0xe1ffe6"> <mx:Canvas label="web" width="100%" height="100%"> <mx:Label x="27" y="46" text="URL"/> <mx:Label x="27" y="72" text="縦横ãµã¤ãº"/> <mx:TextInput id="myUrlTxt" x="127" y="44" width="188" text="http://google.co.jp" enter="{myHtml.location=myUrlTxt.text}" /> <mx:TextInput id="myHtmlH" x="127" y="70" width="64" text="600"/> <mx:TextInput id="myHtmlW" x="218" y="70" width="64" text="800"/> <mx:Label x="199" y="72" text="x"/> <mx:Button x="323" y="44" label="GO" click="{myHtml.location=myUrlTxt.text}"/> </mx:Canvas> <mx:Canvas label="clip" width="100%" height="100%"> <mx:Button x="111.5" y="59" label="ã¯ãªãããã¼ãããèªã¿è¾¼ã¿" click="getClipbord()"/> </mx:Canvas> </mx:ViewStack> <!--ãã£ããã£ã¼ãªãã·ã§ã³--> <mx:RadioButtonGroup id="radiogroup2"/> <mx:ViewStack x="400" y="49" id="viewstack2" width="257" height="150" selectedIndex="{int(radiogroup2.selectedValue)}" backgroundColor="0xfff6db"> <mx:Canvas label="ãã¥ã¼ 1" width="100%" height="100%"> <mx:Button id="myButton0" x="75.5" y="59" label="ãã¼ã¸ãã£ããã£" click="getPage()"/> </mx:Canvas> <mx:Canvas label="a" width="100%" height="100%"> <mx:Button id="myButton" x="81.5" y="92" label="é¨åãã£ããã£ã¼" click="getCap()"/> <mx:TextInput id="myTestH" x="81.5" y="23" width="64" text="200"/> <mx:TextInput id="myTestW" x="172.5" y="23" width="64" text="300"/> <mx:Label x="153.5" y="25" text="x"/> <mx:Label x="20.5" y="25" text="縦横ãµã¤ãº"/> <mx:CheckBox id="myTestV" x="81.5" y="53" label="表示" selected="false"/> </mx:Canvas> </mx:ViewStack> <!--ç»åä¿å--> <mx:Canvas x="667" y="49" width="188" height="150" backgroundColor="0xe1e3ff"> <mx:Image id="myImage" x="10" y="10" width="129" height="100"/> <mx:Button id="mySaveBtn" label="ç»åä¿å" enabled="false" click="saveImage()" x="108" y="118"/> <mx:TextInput id="finishTxt" x="46" y="119" text="ä¿åå®äºï¼" visible="false" width="55" /> </mx:Canvas> <!--ã¢ããªã±ã¼ã·ã§ã³ã³ã³ããã¼ã«ãã¼--> <mx:ApplicationControlBar x="10" y="11" width="382"> <mx:RadioButton label="Web" value="0" groupName="radiogroup1" selected="true"/> <mx:RadioButton label="ã¯ãªãããã¼ããã" value="1" groupName="radiogroup1"/> </mx:ApplicationControlBar> <mx:ApplicationControlBar x="400" y="11" width="259"> <mx:RadioButton label="丸ãã¨ãã£ããã£" value="0" groupName="radiogroup2" selected="true"/> <mx:RadioButton label="é¨åãã£ãã¿" value="1" groupName="radiogroup2"/> </mx:ApplicationControlBar> <mx:ApplicationControlBar x="667" y="11" width="188" barColor="0x46458a" height="33"> <mx:Label text="åºåç»å"/> </mx:ApplicationControlBar> </mx:WindowedApplication>
ã¯ãªãããã¼ãããã¡ã¤ã«åºåé¢ä¿ã¯ãã¡ãã便å©
Adobe AIRãããã§ãã·ã§ãã«ã¬ã¤ã Windows & Macintosh対å¿
- ä½è : ã¯ã¸ã©é£è¡æº
- åºç社/ã¡ã¼ã«ã¼: æ¯æ¥ã³ãã¥ãã±ã¼ã·ã§ã³ãº
- çºå£²æ¥: 2008/06/25
- ã¡ãã£ã¢: åè¡æ¬ï¼ã½ããã«ãã¼ï¼
- è³¼å ¥: 7人 ã¯ãªãã¯: 74å
- ãã®ååãå«ãããã° (18件) ãè¦ã