トップへ戻るニュースフォーラムFLASH-ML 過去ログBak@Flaダウンロードよくある質問と答
ログイン
ユーザ名:

パスワード:


パスワード紛失

新規登録
メインメニュー
メイン
   コーダーズルーム【スクリプト系】
     onEnterFrameの動作
投稿するにはまず登録を

フラット表示 前のトピック | 次のトピック
投稿者 スレッド
rindo
Åê¹ÆNo.25850
投稿日時: 2006-5-31 11:10
常連
居住地: 埼玉
投稿: 196
使用環境:
Re: onEnterFrameの動作
他のスレでのmitsuruさんの引用ですが、
引用:

文法等基本を身につけるのと同様に、というかある意味ではそれ以上に大切なことが、
『デバッグする方法、習慣をみにつける』ということかもしれませんね。

まったく、私にも適用されることですね。(汗)

ところで、一つ確認したいのですが、
野中さんの書かれた

var speed = 0;
var accel = 1;
var boundPos = 200;
function bound() {
    this._y += this.speed;
    if (this._y>=this.boundPos) {
        this.speed *= -1;
    } else {
        this.speed += this.accel;
    }
}
function xSetAnimation(_mc) {
    _mc.speed = speed;
    _mc.accel = accel;
    _mc.boundPos = boundPos;
    _mc.onEnterFrame = bound;
}
xSetAnimation(ball1_mc);
xSetAnimation(ball2_mc);

このコードで引数があるので、
ボタンから動作させる書き方として、
以下の2つ書いてみましたが、
書き方としては、こういった書き方は良くないとかの
指摘が御座いましたら、ご意見をお願いしたいのですが。
よろしくお願いします。
あくまで、メインrootの1フレでの記述方法としてですが。

var speed = 0;
var accel = 1;
var boundPos = 200;
function bound() {
    this._y += this.speed;
    if (this._y>=this.boundPos) {
        this.speed *= -1;
    } else {
        this.speed += this.accel;
    }
}
function xSetAnimation(_mc) {
    _mc.speed = speed;
    _mc.accel = accel;
    _mc.boundPos = boundPos;
    _mc.onEnterFrame = bound;
}
ここで、更に関数を作成
--------------------------------
以下のスクリプトで動作させる。
btn_mc.onRelease = function() {
    xSetAnimation(ball1_mc);
    xSetAnimation(ball2_mc);
}
もう一つの書き方は、更に関数を作成して
function btnStart() {
    xSetAnimation(ball1_mc);
    xSetAnimation(ball2_mc);
}
以下のスクリプトで動作させる。
btn_mc.onRelease = btnStart;

私個人的には
xxx.onRelease = function(){
を使うよりか
xxx.onRelease = fffff;の書き方のほうが
直感的に理解し易いと思うのですが・・・。
どうなのでしょう。


----------------
site:
http://www.yumenext.com/
blog:
http://star.ap.teacup.com/flash/

フラット表示 前のトピック | 次のトピック

題名 投稿者 日時
   onEnterFrameの動作 rindo 2006-5-26 17:42
     Re: onEnterFrameの動作 mayor 2006-5-26 18:20
       Re: onEnterFrameの動作 rindo 2006-5-26 19:06
         Re: onEnterFrameの動作 mayor 2006-5-26 19:17
           Re: onEnterFrameの動作 rindo 2006-5-26 23:47
     Re: onEnterFrameの動作 youich 2006-5-27 1:04
       Re: onEnterFrameの動作 rindo 2006-5-27 10:00
         Re: onEnterFrameの動作 rindo 2006-5-28 18:56
           Re: onEnterFrameの動作 mayor 2006-5-28 19:41
             Re: onEnterFrameの動作 rindo 2006-5-28 20:32
               Re: onEnterFrameの動作 Fumio 2006-5-28 20:46
                 Re: onEnterFrameの動作 rindo 2006-5-28 21:12
                 Re: onEnterFrameの動作 rindo 2006-5-28 21:16
                 » Re: onEnterFrameの動作 rindo 2006-5-31 11:10
                     Re: onEnterFrameの動作 Fumio 2006-6-1 11:59
                       Re: onEnterFrameの動作 rindo 2006-6-1 18:38
           Re: onEnterFrameの動作 Fumio 2006-5-28 20:02

投稿するにはまず登録を
 
Copyright (C) 2003 FLASH-japan. All rights reserved.
Powered by Xoops