TCggbv

Director Flash Ɩe vtB[
  �y����J�Â����ActionScript 3.0�Z�~�i�[�z
 
67
F-site�Z�~�i�[
�y���@�@���z2006�N8��26�y�j��13:15-17:00
�y��@�@���z�����I�����s�b�N�L�O���N�����Z���^�[ �Z���^�[��4F-416��
�y�Q����p�z1,000�~
�y�\����e�z
�mdemo1�n�u�͂��߂Ă�Flash Lite�v�~���@�m(45��)
�mdemo2�n�u���āA�ǂ��g�����HFlash Lite�v�c������(45��)
�mdemo3�n�uAS3.0�ōs�����I�v�쒆���Y(60��)
�m��ƃf���n����(15��)
67
Adobe + ROKUNANA presents Flash 8 INSPIRATION SCENE Summer Jam
�y���@�@���z2006�N9��6�����j��13:30-18:00
�y��@�@���z�Z�{�؃q���Y�A�J�f�~�[�q���Y49�^���[�z�[��
�y�Q����p�z����
�y�\����e�z
�m��1���n�uFlash Professional 9 ActionScript 3.0 Preview�K�C����v�쒆���Y(75��)
�m��2���n�uINSPIRATION SCENE Summer Jam Final Session�vkoji NISHIDA/�^�i�J�~�m��/���؋v�V/�g�U�L�P�C�C�`/�^���A�E�g(120��)
  �yActionScript 3.0 Mailing List�J�݁I�z

ActionScript 3.0 Debut Seminar

ActionScript 3.0����������

Date: 2006�N7��14�� Product: Flash

Platform: All
Viersion: 9.0

1. ActionScript 1.0�C�x���g�n���h���A�N�V����

Flash 5�X�^�C���BMovieClip�A�N�V�����ɃC�x���g�n���h���A�N�V����onClipEvent()���L�q���āA�C�x���g���w�肷��B�A�j���[�V�����̏����́AenterFrame�C�x���g����΁B�����ݒ�̏����́AonClipEvent (load)�n���h���ōs���B

�ȉ���MovieClip�A�N�V����(�X�N���v�g001)�́AMovieClip�C���X�^���X���}�E�X�|�C���^�ɒǐ�������[*1]�B

�X�N���v�g001���}�E�X�|�C���^�ɒǐ�����MovieClip�A�N�V����

// MovieClip: �}�E�X�|�C���^�ɒǐ�����C���X�^���X
// MovieClip�A�N�V����
onClipEvent (load) {
  var nDeceleration = 0.2;   // ������(0����1�̊Ԃ̏����l)
}
onClipEvent (enterFrame) {
  _x += _xmouse*nDeceleration;
  _y += _ymouse*nDeceleration;
}


[*1] �����̃A�j���[�V�����ɂ‚��ẮAF-site�Z�~�i�[�uMovieClip�̃^�[�Q�b�g�p�X�ƃv���p�e�B�v�����Flash Power Session 2004 in Osaka�uActionScript 6�‚̃e�N�j�b�N�v�́u4. �C�[�Y�A�E�g�̌����v�Q��

2. ActionScript 1.0�C�x���g�n���h�����\�b�h

Flash MX�X�^�C���B�t���[���A�N�V�����ɃC�x���g�n���h�����\�b�h���L�q����B�A�j���[�V�����̏����́AMovieClip.onEnterFrame�C�x���g�n���h�����\�b�h�ōs���B�C�x���g�n���h�����\�b�h�́A���߂�ꂽ���O��function(�֐�)��MovieClip�C���X�^���X�ɒ�`���邱�Ƃɂ��ݒ�ł���[*2]�B

�O�q�X�N���v�g001���C�x���g�n���h�����\�b�h�Ƃ���MovieClip�̃t���[���A�N�V�����Ƃ��Ē�`����ƁA�‚��̂悤�ɂȂ�(�X�N���v�g002)�B

�X�N���v�g002���}�E�X�|�C���^�ɒǐ�����t���[���A�N�V����1.0

// MovieClip: �}�E�X�|�C���^�ɒǐ�����C���X�^���X
// ��1�t���[���A�N�V����
var nDeceleration = 0.2;
function onEnterFrame() {
  _x += _xmouse*nDeceleration;
  _y += _ymouse*nDeceleration;
}


[*2] �ȉ��̂ӂ��‚�function(�֐�)��`�́A�قړ����Ӗ��B

function onEnterFrame() { }

this.onEnterFrame = function() { }

3. ActionScript 3.0�C�x���g���X�i�[

ActionScript 1.0�̃t���[���A�N�V����(�X�N���v�g002)���AActionScript 3.0�̃V���^�b�N�X�ɏ��ւ��Ă݂�(�X�N���v�g003)�B

ActionScript 3.0�ł́A�C�x���g�̓��X�i�[�ɔz�M�����B���X�i�[�̓o�^�ɂ́AEventDispatcher.addEventListener()���\�b�h��p����B���X�i�[�Ɏw�肵��function(�֐�)�̈���(�o�����[�^)�̐�������Ȃ��Ɠ{����(�}001)�B�N���X�͒���������(���S�C���N���X��)�ŁAimport�X�e�[�g�����g���L�q���Ă����B

ActionScript 3.0�ł́A�v���p�e�B���̐擪�ɂ́u_�v(�A���_�[�X�R�A�E�A���_�[�o�[)���‚��Ȃ�[*3]�B

ActionScript 2.0�Ɠ������A�ϐ�(�v���p�e�B)��function(�֐��E���\�b�h)�̈����A�߂�l�ɂ́A�����Ȍ^�w�肪�ł���[*4]�B

�X�N���v�g003���}�E�X�|�C���^�ɒǐ�����t���[���A�N�V����3.0

// MovieClip: �}�E�X�|�C���^�ɒǐ�����C���X�^���X
// ��1�t���[���A�N�V����
import flash.events.Event;   // Event�N���X��import
var nDeceleration:Number = 0.2;
// �C�x���g���X�i�[�ւ̓o�^
addEventListener(Event.ENTER_FRAME, myEnterFrame);   // [*5]
function myEnterFrame(eventObject:Event):void {
  x += mouseX*nDeceleration;
  y += mouseY*nDeceleration;
}

�}001�������̐��̕s��v��m�点��G���[
ArgumentsError
�����^��Ƃ��āA�u�K�v�v�Ȉ����͂ЂƂ�(1)�ŁA���́u�w��v���Ȃ�(0)����G���[�Ȃ̂ł͂Ȃ����낤��...

[*3] MovieClip._xmouse/MovieClip._ymouse�v���p�e�B�́ADisplayObject.mouseX/DisplayObject.mouseY�v���p�e�B�ɕς��B

[*4] function(�֐�)�̖߂�l���Ȃ��Ƃ�ActionScript 2.0�Ŏg��ꂽVoid�^�́AActionScript 3.0�ł͏������Ŏn�܂�void�ɂȂ�̂Œ��ӂ���K�v������B

[*5] Event.ENTER_FRAME�͒萔�ŁA������"enterFrame"��Ԃ��B���������āAEventDispatcher.addEventListener()���\�b�h�̑�1�����ɁA������"enterFrame"�𒼐ڎw�肵�Ă��悢�B

4. ActionScript 2.0�N���X��`

ActionScript 2.0�N���X�́AActionScript�t�@�C���ɒ�`����B�v���p�e�B�⃁�\�b�h�ɂ́A�����Ȍ^�w�肪�ł���B�C�x���g�̈����́A�C�x���g�n���h�����\�b�h��p����(�ꕔ�A���X�i�[���g���ꍇ������)�BMovieClip�V���{���ɐݒ肷��N���X�́AMovieClip�N���X���p��(extends)����B

�X�N���v�g004���}�E�X�|�C���^�ɒǐ�����ActionScript 2.0�N���X

// ActionScript 2.0�N���X��`�t�@�C��: MyClass.as
class MyClass extends MovieClip {
  var nDeceleration:Number = 0.2;
  function onEnterFrame():Void {
    _x += _xmouse*nDeceleration;
    _y += _ymouse*nDeceleration;
  }
}

�N���X�́A�V���{����[AS 2.0�N���X]�ɐݒ�ł���[*6]�B

[*6] [���C�u����]��MovieClip�V���{����I�����A�I�v�V�����|�b�v�A�b�v���j���[����[�v���p�e�B]��I�ԁB[�V���{���v���p�e�B]�_�C�A���O�{�b�N�X��[AS 2.0�N���X]��ActionScript 2.0�N���X���w�肷��(�}002)�B

�}002��[�V���{���v���p�e�B]�_�C�A���O�{�b�N�X
Symbol Properties
[AS 2.0�N���X]��ActionScript 2.0�N���X���w�肷��

5. ActionScript 3.0�N���X��`

ActionScript 3.0�̃N���X��`�́Apackage�̐錾����n�܂�B�N���X��public�C���q�Ŏw�肷��B��{�I�ȕ��@�I�́AActionScript 2.0�Ƒ傫���قȂ邱�Ƃ͂Ȃ��BActionScript2 2.0�Ɠ������A�����ݒ�̓N���X�Ɠ����̃R���X�g���N�^�֐�����s���B

�������A�N���X�̃f�U�C�����ς���Ă���̂ŁA�������t�@�����X���Q�Ƃ���K�v������BMovieClip�N���X�̊��S�C�����́Aflash.display.MovieClip�ƂȂ�B

�X�N���v�g005���}�E�X�|�C���^�ɒǐ�����ActionScript 3.0�N���X

// ActionScript 3.0�N���X��`�t�@�C��: MyClass.as
package {
  import flash.display.MovieClip
  import flash.events.Event;
  public class MyClass extends MovieClip {
    var nDeceleration:Number = 0.2;
    // �R���X�g���N�^�֐�
    function MyClass() {
      addEventListener(Event.ENTER_FRAME, myEnterFrame);
    }
    function myEnterFrame(eventObject:Event):void {
      x += mouseX*nDeceleration;
      y += mouseY*nDeceleration;
    }
  }
}

_____

�쐬��: �쒆���Y
�X�V��: 2006�N7��17�� import�w���q�Ƀ��t�@�����X�ւ̃����N��ݒ�
�쐬��: 2006�N7��15��
(�h���t�g�쐬: 2006�N7��14��)


Copyright © 2001-2006 Fumio Nonaka.  All rights reserved.
�@ �@