Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 436
  • Last Modified:

DataGrid and ScrollPane: error #1009

Flash CS4, AS 3.0:
In the example below I get the error #1009 (executing the last line of code). No idea why. Please help:

import fl.controls.DataGrid;
import fl.controls.dataGridClasses.DataGridColumn;
import fl.data.DataProvider;
import fl.events.DataGridEvent;
import fl.controls.listClasses.CellRenderer;
import fl.controls.dataGridClasses.HeaderRenderer;

var mc1:MovieClip = new MovieClip();
var dgSortiment:DataGrid = new DataGrid();
var dp:DataProvider = new DataProvider();

//Column-definition
dgSortiment.addColumn("Matchcode");

//Add some data
dp.addItem({Matchcode: "Test1"});
dp.addItem({Matchcode: "Test2"});
dp.addItem({Matchcode: "Test3"});

dgSortiment.dataProvider=dp;
mc1.addChild(dgSortiment);
scrollPane1.source=mc1;  //After executing, error occurs

Thanks for your help

Peter
0
formi
Asked:
formi
  • 2
  • 2
1 Solution
 
blue-genieCommented:

is the error access of undefined property?

is scrollPane1 placed directly on the stage with the correct instance name?
or have you placed it at runtime using addChild somewhere?

0
 
formiAuthor Commented:
Thanks for your answer:

the error is (translated from german ...): TypeError: Error #1009: access impossible on a property or method of a null-object-link.

I placed the scrollPane directly on the stage.
0
 
blue-genieCommented:
okay  i copied and pasted your code exactly as it is.
Placed an instance of the datagrid and scrollpane components on the stage.
deleted the datagrid (so its just in the library)

gave the scrollpane an instance name of scrollPane1

ran the movie.
works fine, no error messages.

if i don't place the scrollpane on the stage with instance name,  I get the error you refer to .
so suggestion check your instance name otherwise upload your file (change.fla extension to .txt)
0
 
formiAuthor Commented:
I didn't know that one has to put a dynamically created component to add (and delete) it on the stage. This was the only problem. Thanks a lot!
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now