forked from: forked from: forked from: forked from: flash on 2010-6-2

by ir_77 forked from forked from: forked from: forked from: flash on 2010-6-2 (diff: 1)
♥0 | Line 57 | Modified 2010-06-02 21:13:57 | MIT License
play

ActionScript3 source code

/**
 * Copyright ir_77 ( http://wonderfl.net/user/ir_77 )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/91lN
 */

// forked from ir_77's forked from: forked from: forked from: flash on 2010-6-2
おやつを食べながらFlashとかを勉強しよう
wonderflの使い方

without comments


AS3をオンライン上で書いて実行できる無料のサービス、wonderflの使い方。

AS3で自分用のメモがてらにテストしたりの簡単なものを作るんだったら、wonderflがお勧め。ほかの人が作った動くコードも見て、改変しながら、いつの間にか自分のモノも作れるようになっちゃう(かも)。
ログイン

結構ここで躊躇している人が多いが、wonderfl wonderfl専用のめんどくさいユーザー登録とかは無い。OpenIDという仕組みを使っているので、mixiGoogleYahoo!JAPAN,Hatena,Yahoo,livedoorのアカウントを持っているなら、そのまま数クリックでログインできちゃう。もちろん、mixiのパスワードがwonderflに筒抜け、なんてことも無い。




選んだサービス(例えばmixi)にログインしてたら直後に、wonderflにログイン完了。
mixiにログインしていなかったら、mixiページに飛んでIDPWを入力すれば、wonderflにログイン完了。
早速作ろう

Build from scratch」ではじめよう。
↓で、これをコピペ

package {
	import flash.display.Sprite;
	public class Main extends Sprite {
		public function Main() {
			this.graphics.beginFill(0xFF0000, 0.5);
			this.graphics.drawRoundRect(0, 0, 100, 100, 8, 8);
			this.graphics.endFill();
		}
	}
}


結果例
flash on 2010-4-23
http://wonderfl.net/c/6BeR
ブログに貼ろう

http://wonderfl.net/c /6BeRのページの右上あたりに「ブログに貼る」欄があります。その中のタグをコピーして、ウェブページやblogにペーストすると、blogパーツのようにFlashコンテンツを貼り付けることができます。
flash on 2010-4-23  wonderfl build flash online
[おまけ]プライベートなクラスの作り方
プライベートなクラス  wonderfl build flash online

wonderflでは、ユーザーは一度に一つのソースファイルしか使えない。
つまり、クラスファイルを分けることができない。
そこで、一つのソースファイルに複数のクラスを含める「プライベートなクラス」の作り方を理解する必要がある、かもしれない。

/*
一つのソースファイルに複数のクラスを含める
「プライベートなクラス」の作り方
*/
package{
	import flash.display.Sprite;
	import flash.events.Event;
	public class Main extends Sprite{
		private var _maru:Maru;
		public function Main(){
			_maru = new Maru();
			_maru.x = 100;
			_maru.y = 100;
			this.addChild(_maru);
		}
	}
}

//プライベートなクラス
//次のようにpackageと
//classの前のpublicを省く
import flash.display.Sprite;
class Maru extends Sprite{
	public function Maru(){
		this.graphics.beginFill(0xFF0000);
		this.graphics.drawCircle(0,0,50);
		this.graphics.endFill();
	}
}