“FlashPlatform SourceIntegration”的版本间的差异
来自Blueidea
(以内容“Category:Thinking in ActionScript”创建新页面) |
|||
| 第1行: | 第1行: | ||
[[Category:Thinking in ActionScript]] | [[Category:Thinking in ActionScript]] | ||
| + | |||
| + | ==嵌入素材== | ||
| + | 以嵌入圖片為例。最簡單快速的方式。 | ||
| + | <syntaxhighlight lang="actionscript"> | ||
| + | package { | ||
| + | import flash.display.Bitmap; | ||
| + | import flash.display.Shape; | ||
| + | import flash.display.Sprite; | ||
| + | import flash.display.StageAlign; | ||
| + | import flash.display.StageScaleMode; | ||
| + | |||
| + | [SWF(width="128", height="128")] | ||
| + | /** | ||
| + | * The <code>Text</code> class.<br/> | ||
| + | */ | ||
| + | public class Test extends Sprite { | ||
| + | //========================================================================== | ||
| + | // Constructor | ||
| + | //========================================================================== | ||
| + | /** Constructor */ | ||
| + | public function Test() { | ||
| + | stage.align = StageAlign.TOP_LEFT; | ||
| + | stage.scaleMode = StageScaleMode.NO_SCALE; | ||
| + | const B:Bitmap = new $clazz() as Bitmap; | ||
| + | addChild(B); | ||
| + | } | ||
| + | [Embed(source="bunny.jpg")] | ||
| + | private var $clazz:Class; | ||
| + | } // <- end class -> | ||
| + | } | ||
| + | </syntaxhighlight> | ||
2011-04-13T23:08:00的版本
嵌入素材
以嵌入圖片為例。最簡單快速的方式。
package { import flash.display.Bitmap; import flash.display.Shape; import flash.display.Sprite; import flash.display.StageAlign; import flash.display.StageScaleMode; [SWF(width="128", height="128")] /** * The <code>Text</code> class.<br/> */ public class Test extends Sprite { //========================================================================== // Constructor //========================================================================== /** Constructor */ public function Test() { stage.align = StageAlign.TOP_LEFT; stage.scaleMode = StageScaleMode.NO_SCALE; const B:Bitmap = new $clazz() as Bitmap; addChild(B); } [Embed(source="bunny.jpg")] private var $clazz:Class; } // <- end class -> }