?
Solved

DataGrid and ScrollPane: error #1009

Posted on 2010-01-12
4
Medium Priority
?
433 Views
Last Modified: 2013-11-11
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
Comment
Question by:formi
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 39

Expert Comment

by:blue-genie
ID: 26292492

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
 

Author Comment

by:formi
ID: 26292530
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
 
LVL 39

Accepted Solution

by:
blue-genie earned 2000 total points
ID: 26292715
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
 

Author Closing Comment

by:formi
ID: 31676045
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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Sometimes you know that one object has a specific child in it, but you can't find the child. This happened to me when I was trying to code some actionScript to make a toolbar work with its embedded buttons.  My partner had created the toolbar usi…
I have been doing hardcore actionscripting for some time; and needless to say I have faced a lot of problems in just understanding others' code rather than understanding what the code executes. A programmer's life can become hell when there are a lo…
The goal of the tutorial is to teach the user how to how to load their YouTube profile onto Flash Media Live Encoder.
The goal of the tutorial is to teach the user how to select which audio input to use. Once you have an audio input plugged into the laptop or computer, you will go into the audio input settings and choose which audio input you want to use.
Suggested Courses

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question