TOP > Flash,Actionscript Q&A

Q&A

Flash,Actionscript Q&A feature released!

When you have something you want to do with Flash and Actionscript but you don't know the way to code it,
it's better not to ask for everything, but you'd better go as far as you can and at last, ask somebody for only the rest.
You can do this with wonderfl.

Use wonderfl, to ask questions about your code, and answer others questions.

How to ask: write code, explain your question in the title and comments, and tag it "question"
-> more info about: How to 'ask a question' in Q&A feature

How to answer: fork the question code and modify it
-> more info about: How to answer a question in Q&A feature

How to close question: change "question" tag into "question-closed"
-> more info about: How to close a question in Q&A feature

* It doesn't have to be exactly a Question and Answer, can be a Topic or a Contest which uses wonderfl's fork feature to gather codes.
* for example: "Use this template and write something cool with less than 140 characters!"

QUESTIONS

List of questions waiting for answers.1 - 20 of 26 results

  1. // somebody please optimize this code!
  2. // source code: http://github.com/mash/ContextFreeArt-AS3
  3. // This software is a port of ContextFree.js to Actionscript3.
  4. // Context Free Art is http://www.contextfreeart.org/index.html
  5. // ContextFree.js is http://code.google.com/p/contextfree/
  6. // some hints about implementation for improvement
  7. // ContextFree is a combination of resized primitive shapes:
flash thumbnail
  1. /*
  2.  * http://actionsnippet.com/?p=2489
  3.  * を参考に作ってみました。
  4.  * 
  5.  * オブジェクトを作って何個載せられるかというゲームにしたかったんですが、
  6.  * ちょっとしたサイズのものでもすぐにバランス崩して倒れてしまうので
  7.  * ゲームとして成立してません。^^;
  8.  * 
  9.  * 重さに対する影響度とか指定できないんでしょうか。
  10.  */
flash thumbnail
  1. // 普段はthisを書かない派ですが、Tweensyで自身をトゥイーンしたいとき等は仕方なくthisを書きます。
  2. // でも、イベントハンドラとして渡した無名関数の中では、thisはglobalになってしまうので使えません。
  3. // だからクロージャーでthisを無名関数内に持ち込むことにしました。
  4. // ところが"this"は予約語なので、他の名前を付ける必要があります。今回は"self"としてみました。
  5. // こんなやり方しかないのでしょうか? もっといいやり方があれば教えてください。
  6. // または、皆さんは普段どのように書いていますか?
  7. // このやり方では、thisを書かなかったり、書いたり、selfと書いたり、一貫性が無いのが悩みです。
  8. // コードの先頭で var self = this; と書いてあとはselfだけを使うという手もありますが。。。
  9. // それか、最も内側でwithされてるインスタンスを取得する方法があればそれがベストかも知れません。
  10. package {
flash thumbnail
  1. /*
  2. http://wonderfl.net/code/de1743a4ffcb01ff7fa78f3ccc9bc8277e3b16b9#
  3. 上記のサンプルを実行したのですが、マウスアップで音声が再生されません。
  4. 似たような録音&再生のサンプルがありますが、どれもダメです。
  5. FP10.1のインストール以外に何か必要でしょうか?
  6. OSはXPでブラウザはIE,FF,Chromeなど色々試しました。
  7. マイクは許可になっており、他のスペクトラム表示のサンプルでは反応しています。
  8. また、この録音とはPCのローカルハードディスクへ何らかの形式でサウンドを保存して再生しているのでしょうか?
  9. */
flash thumbnail
  1. /*
  2.  *
  3.  * This is the standard example for importing external classes 
  4.  * from an ApplicationDomain class, but it won't work in wonderfl.
  5.  *
  6.  * Is there a way to make this work, or is it just impossible to do?
  7.  *
  8.  */
  9. package {
  10.     import flash.display.DisplayObject;
flash thumbnail
  1. // forked from eri's forked from: forked from: forked from: Flickr pipes
  2. //
  3. //XMLで画像を読みこんだスライドショー
  4. //
  5. //スライドショーを探し当てる事が出来ずquestionに入れさせて頂きました。
  6. //
  7. //よろしくお願いします。
  8. //
  9. package {
flash thumbnail
  1. // I d like to pass a number (id) to the arduino attached to this computer
  2. // so this id could spread via XBee to another arduino which needs this number
  3. // to response with a string.
  4. // Dozo, See the code where HELP is NEEDED.
  5. package {
  6.     import flash.utils.Timer;
  7.     import flash.display.Sprite;
  8.     import flash.events.Event;
  9.     import funnel.*;
flash thumbnail
  1.     /* sp1→sp2→sp3 という風に TweensyTimeline の onComplete を使って順番に動かしています。
  2.      * 実際、順番に動いてはいるのですが、アニメーションさせるinstanceが増えれば増えるほど
  3.      * このようにネストしてしまうものなのでしょうか?
  4.      * それとも、もっとスマートに書くイカした方法があるのでしょうか?
  5.      * to,from,fromtoはどうしても使いたいです。
  6.      * 詳しい方教えてください。
  7.      * よろしくお願いします。
  8.      * */
  9. package {
  10.     import com.flashdynamix.motion.*;
flash thumbnail
  1. //How can I draw a circle with dashed line/stroke?
  2. //Using a for cycle and using the equation of the circle wouldn't it be too slow?
  3. package {
  4.     import flash.display.Sprite;
  5.     import flash.display.Shape;
  6.     import flash.display.LineScaleMode;
  7.     import flash.display.CapsStyle;
  8.     import flash.display.JointStyle;
  9.     public class DashedCircle extends Sprite {
flash thumbnail
  1. /*
  2.  *
  3.  * http://livedocs.adobe.com/flex/3_jp/langref/flash/text/TextField.html#methodSummary
  4.  *
  5.  * livedocのTextFieldのページをみてもgetRawText()の記述が無い(他にもいくつかある)けど
  6.  * これはhtmlTextに渡したhtml文章からhtmlタグをはずした
  7.  * 文章をかえしてくれるってことでいいんでしょうか?
  8.  *
  9.  * */
  10. package{
flash thumbnail
  1. /**
  2.  * #16 Conway's Game of Life v3
  3.  * 
  4.  * ConvolutionFilter + paletteMap によるライフゲーム高速化実験。
  5.  * 意図的に遅くしないといけないとか、速すぎます。
  6.  * 色は意外と作られていない白黒にしてみました。おおよそ理解できたつもり。
  7.  * ところで黒白はどうやって作れば良いのでしょうか?
  8.  *
  9.  * FIXED:
  10.  * 乱数の種を常に0にしてたの忘れてた。ちょっとだけ増やしときますね。
flash thumbnail
  1. // stageを連打してるとClickThreadのinterruptedが実行されないことがたまにある
  2. // 一回目のクリックから3秒後にMainThreadからClickThreadにinterruptしてる
  3. package
  4. {
  5.     import flash.display.*;
  6.     import org.libspark.thread.Thread;
  7.     import org.libspark.thread.EnterFrameThreadExecutor;
  8.     public class InterruptTest extends Sprite
flash thumbnail
  1. // how can I know if I'm running 465x465 or fullscreen?
  2. // 465,465 even in
  3. // http://wonderfl.net/code/79734b4ac942acb8a995a8993ae4b14a7657da8b/fullscreen
  4. package {
  5.     import flash.display.Sprite;
  6.     import flash.text.*;
  7.     public class FlashTest extends Sprite {
  8.         [SWF(width=465, height=465, backgroundColor=0x999999)]
  9.         public function FlashTest() {
flash thumbnail
  1. // forked from hacker_7i4tn9on's forked from: The same brightness looks different.
  2. // forked from borealkiss's The same brightness looks different.
  3. /*
  4. 左側が赤(赤255 = #FF0000)と黒(#000000)を使って
  5. チェック柄に塗りつぶした四角形、
  6. 右側が明るさ半分の赤(赤128 = #800000)で塗りつぶした四角形。
  7. チェック柄が見えなくなるぐらい十分離れた位置から見ると
  8. どちらの四角形も同じ”半分の明るさの赤色”に見えるはずだが。
  9. */
flash thumbnail
  1. // midnghthei
  2. // forked from Murai's wonderFl_KeyVisual_v1
  3. // write as3 code here..
  4. package 
  5. {
  6.     
  7.     /**
  8.      * 
  9.      * @author Takashi Murai(KAYAC)
  10.      */
flash thumbnail
  1. package {
  2.     import flash.display.Stage;
  3.     import flash.display.StageAlign;
  4.     import flash.display.StageScaleMode;
  5.     import flash.display.Sprite;
  6.     import flash.display.Bitmap;
  7.     import flash.display.BitmapData;
  8.     import flash.geom.ColorTransform;
  9.     import flash.geom.Rectangle;
flash thumbnail
  1. package  
  2. {
  3.     /**
  4.      * PV3D でマルチビュー
  5.      * 
  6.      * ということで作ったものの、マルチビューは実現することができたのですが、期待通りの結果になりません。
  7.      * 
  8.      * 
  9.      * 
  10.      * --- 問題個所 ---
flash thumbnail
  1. package { 
  2.     
  3.     /*
  4.      * [勉強]perlinNoiseを動かす(の解説を初級者がしてみる)
  5.      * 
  6.      * Forkするかどうかについて考えた結果、「Forkしないでくれ」って
  7.      * いう意見があったら削除する方向で行きたいと思います。
  8.      * 
  9.      * 毎度思うんですけど、コメントの幅がどれくらいあればいいのか
  10.      * 気になりますね。
flash thumbnail
  1. package
  2. {
  3.     /*
  4.      * [追記]皆さん好意的な意見ありがとうございます。
  5.      * 少し安心しました。バッシング来たらどうしようかと思ってたので(笑
  6.      * 
  7.      * ただ、自分の作ったコードがおおっぴらに解析されるっていうのは
  8.      * 恥ずかしかったり、あるいは気分のいいものでは無かったりする
  9.      * というのは自分でもなんとなく判るので、難しいところですね。
flash thumbnail
  1. //小さくうねったり大きくうねったりランダムな感じ(かつ自然な感じ)にしたい。
  2. //ロジックを変えて一応ランダムなうねうねにした・・・けどイマイチ
  3. //一定周期毎の変化じゃなくだんだん周期が変化する感じにしたい。
  4. package 
  5. {
  6.     import flash.display.Sprite;
  7.     import flash.display.Stage;
  8.     import flash.events.Event;
  9.     
  10.     /**
flash thumbnail
Get Adobe Flash Player