LoginSignup
1
1

More than 5 years have passed since last update.

getDefinitionByName() で ReferenceError: Error #1065 が出る場合

Last updated at Posted at 2013-07-29

たとえば、以下のようなコードがあるとする。

ex1
var clazz:Class = getDefinitionByName('com.example.classes.Hoge');

このコードを実行したとき、以下のエラーが出る場合がある。

ex2
ReferenceError: Error #1065: 変数 Hoge は定義されていません。
    at global/flash.utils::getDefinitionByName()

どうも、あらかじめメモリ上に Hoge クラスがロードされていないために発生しているっぽい。

なので、以下のようにあらかじめ Hoge クラスがメモリ上にロードされるようにしてあげると解決する。

ex3
import com.example.classes.Hoge;

// あらかじめクラスをロードさせる
Hoge;

var clazz:Class = getDefinitionByName('com.example.classes.Hoge');
1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1