DP187
DP187

Reputation: 11

AS3 Error 1046 & 1180

I am trying to make a data grid were name and score is added to it. I keep getting an error...

1046 Type was not found or was not a complile-time constant: DataProvider. 1080 Call to a possibly undefinded method DataProvider

and here is my coding...

var scoreArray = new Array();

D_G.addColumn("player");
D_G.addColumn("score");

enter_btn.addEventListener(MouseEvent.CLICK, saveScore);

function saveScore(event:MouseEvent):void
{
    var obj:Object = new Object();
    obj.player = tb_name.text;
    obj.score = int(tb_score.text);

    scoreArray.Push(obj);

    scoreArray.sortOn("score", Array.DESCENDING | Array.NUMERIC); 

    var dp:DataProvider = new DataProvider (scoreArray);
    D_G.dataProvider = dp;

}

Upvotes: 0

Views: 187

Answers (2)

prototypical
prototypical

Reputation: 6751

You need to import the DataProvider class ;

import fl.data.DataProvider;

Upvotes: 1

ILikeTacos
ILikeTacos

Reputation: 18666

That error happens when you're not including the class you want to use.

Are you using

import fl.data.DataProvider ??

Upvotes: 1

Related Questions