Hello, Flash World!
Posted on 2月 29th, 2012 by cx20
Flash
Flash は Adobe Systems のブラウザ用プラグインである。名前の由来は FutureWave Software のアニメーションソフト「FutureSplash」から。
MXML(Macromedia Flex Markup Language)は、Adobe Flex の UI を記述する為の XML 言語である。
また、ActionScript は、JavaScript に類似した Flash 用のプログラミング言語である。
ともに、MXML コンパイラを用いることにより、.swf ファイルが生成される。
ソースコード(MXML)
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
<mx:Text text="Hello, Flash World"/>
</mx:Application> |
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
<mx:Text text="Hello, Flash World"/>
</mx:Application>
コンパイル方法(MXML)
上記の MXML による UI 記述は以下の ActionScript のコードに相当する。
ソースコード(ActionScript)
package
{
import flash.display.*;
import flash.text.*;
public class Hello extends Sprite
{
public function Hello()
{
var textField:TextField = new TextField();
textField.text = "Hello, Flash World!";
this.addChild(textField);
}
}
} |
package
{
import flash.display.*;
import flash.text.*;
public class Hello extends Sprite
{
public function Hello()
{
var textField:TextField = new TextField();
textField.text = "Hello, Flash World!";
this.addChild(textField);
}
}
}
コンパイル方法(ActionScript)
ソースコード(HTML)
<html>
<head>
<title>Hello, World!</title>
</head>
<body>
<embed src="Hello.swf" type="application/x-shockwave-flash" width="400" heigt="300" />
</body>
</html> |
<html>
<head>
<title>Hello, World!</title>
</head>
<body>
<embed src="Hello.swf" type="application/x-shockwave-flash" width="400" heigt="300" />
</body>
</html>
実行方法
1. Web サーバの公開フォルダ に配置
2. ブラウザで表示
http://localhost/doc/hello.html |
1. Web サーバの公開フォルダ に配置
2. ブラウザで表示
http://localhost/doc/hello.html
実行結果
Tags: Flash
Categories: Flash