0

私はフラッシュを初めて使用しましたが、このエラーが発生する理由が本当にわかりません。

TypeError:エラー#2007:パラメータテキストはnull以外である必要があります。
flash.text :: TextField / set text()
at sgmap_fla :: MainTimeline / mapOver()

私のアクションスクリプト:

description.countryName_txt.text = "";
description.zone_txt.text = "";

map_mc.buttonMode=true;

map_mc.addEventListener(MouseEvent.MOUSE_OVER, mapOver);
map_mc.addEventListener(MouseEvent.MOUSE_OUT, mapOut);

map_mc.northZone.countryName = "Singapore"; 
map_mc.northZone.zone = "North Zone";

map_mc.centralZone.countryName = "Singapore"; 
map_mc.centralZone.zone = "Central Zone";

map_mc.eastZone.countryName = "Singapore"; 
map_mc.eastZone.zone = "East Zone";

map_mc.westZone.countryName = "Singapore"; 
map_mc.westZone.zone = "West Zone";

map_mc.southZone.countryName = "Singapore"; 
map_mc.southZone.zone = "South Zone";

function mapOver(e:MouseEvent):void{
    var mapItem:MovieClip = e.target as MovieClip;
    description.countryName_txt.text = mapItem.countryName;
    description.zone_txt.text = mapItem.zone;   
    description.gotoAndStop(mapItem.name);
    TweenMax.to(mapItem, .5, {tint:0xFF9900});
    TweenMax.fromTo(description, .5, {alpha:0, x:50, blurFilter:{blurX:80}}, {alpha:1, x:10, blurFilter:{blurX:0}});
    }

function mapOut(e:MouseEvent):void{
    var mapItem:MovieClip = e.target as MovieClip;
    TweenMax.to(mapItem, .5, {tint:0x990000});
    }
4

1 に答える 1

1

テキスト フィールドのテキストを null にすることはできません。

text具体的には、テキスト フィールドプロパティを に設定すると、このエラーが発生しますnullTextFieldこれは、 Classic Textで複製できます。

クラシック テキスト:

var tf:TextField = new TextField();
tf.text = null;

これにより、引用したエラーがスローされます。

エラー #2007: パラメータ テキストは null 以外である必要があります。

TLF テキストにはこの問題はなく、null に設定されている可能性があります。

実装ごとに、これはmapOver(e:MouseEvent)関数内で発生します。mapItem.countryNameまたはnullmapItem.zoneです。どちらも null である可能性があります。

var mapItem:MovieClip = e.target as MovieClip;
description.countryName_txt.text = mapItem.countryName; // null
description.zone_txt.text = mapItem.zone;               // null

マウス イベントは、期待するスコープからディスパッチされていないようです。にリスナーがありますmap_mc:

map_mc.addEventListener(MouseEvent.MOUSE_OVER, mapOver);

次のムービー クリップのいずれかからこのイベントが発生することを期待しているようです: northZonecentralZoneeastZonewestZone、およびsouthZone。これらのシンボルには、探しているプロパティがあります。ただし、map_mc はそうではありません。

したがって、根本的な原因は、イベント リスナーe.targetが期待するシンボルではないことです。

シンボルe.targetが何であるかを確認します。それはおそらくmap_mc、あなたが期待しているプロパティを持っていないものです:

map_mc.countryName; // doesn't exist
mac_mc.zone;        // doesn't exist

の子でこれらのプロパティを探していますmap_mc:

map_mc.northZone.countryName;
map_mc.northZone.zone;

map_mc.centralZone.countryName;
map_mc.centralZone.zone;

// etc...
于 2012-07-10T05:00:08.790 に答える