PDA

View Full Version : How do I Extend the DataProvider class ?(extends doesn't work)


raduCocieru
05-28-2004, 05:18 AM
Hi !
I am trying to extend the DataProvider class so it could work like a Tree but keep the data in an Array.

I've tried to use this:
mx.controls.listclasses.DataProvider

class myDataProvider extends DataProvider{

function myDataProvider(){
}

function fold(id:Number){}

}

I will also override a few baseclass methodes, but for now the above code gives me this:
**Error** E:\xxx\xxxx\myDataProvider.as: Line 3: ActionScript 2.0 class scripts may only define class or interface constructs. :(

Any suggestions ?:confused:
Thanks.

maglez
05-28-2004, 06:55 AM
try importing the DataProvider class...


import mx.controls.listclasses.DataProvider

class myDataProvider extends DataProvider{
function myDataProvider(){
}

function fold(id:Number){}
}

OR

class myDataProvider extends mx.controls.listclasses.DataProvider{
function myDataProvider(){
}

function fold(id:Number){}
}

I don't know if this solve your problem.

raduCocieru
05-28-2004, 07:11 AM
this: import mx.controls.listclasses.DataProvider

class myDataProvider extends DataProvider{
function myDataProvider(){
}

function fold(id:Number){}
}
doesn't work i've tried it just omited to put all the lines on the post.

the second one with the extends mx.controls.listclasses.DataProvider works fine
that's really odd ?:

It just didn't cross my mind

Thanks !

maglez
05-28-2004, 07:25 AM
The import command should works as well.

Check that the value...

$(LocalData)/Classes

...is in the classpath in the ActionScript Settings on Edit>Preference under the tag ActionScript.