Link to home
Start Free TrialLog in
Avatar of gh5150
gh5150

asked on

Flash AS3 1120 Error - Access array data from document class

I have two public arrays held within a class PK called _recordedNotes and _recordedPauses.

I have two arrays generated in a movieclip (codewindo) called notes and pauses

No idea with OOP and document classes so I am hoping someone can tell me how I do the following

Transfer the array data from notes into the _recordedNotes array so essentially

var _recordedNotes:Array = new Array();
_recordedNotes = notes;
var _recordedPauses:Array = new Array();
_recordedPauses = pauses;

yet _recordedNotes is in the PK.as file

or PK.recordedNotes = notes; ?????????????
    PK.recordedPauses = pauses; ???????????


I get

1120: Access of undefined property PK

Whenever I try and send/ copy the array data to the document class PK

CAN ANYONE HELP ???????????
ASKER CERTIFIED SOLUTION
Avatar of CyanBlue
CyanBlue
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of gh5150
gh5150

ASKER

The .as file may make it easier, slightly updated names since posting my question. PK = PianoKeyboard, codewindo = ghwindo etc.

I need to "write"  to both the

_recordedNotes:Array;
 _recordedPauses:Array;  

either from the stage or preferably from within a movieclip called ghwindo

I tried this

var _recordedNotes:Array = new Array();
_recordedNotes == notes;
var _recordedPauses:Array = new Array();
_recordedPauses == arr;
Um. Does my comment above make amy sense to you?

CyanBlue
Avatar of gh5150

ASKER

I must have been reading that late, yeah it does make sense now .... I will try your solution shortly thanks.

gh
Avatar of gh5150

ASKER

Actually - doesn't look like it makes any sense to me

I tried this

var PianoKeyboard:PianoKeyboard = new PianoKeyboard();  
for   pkInstance:PK = new PK();

and
 
PianoKeyboard.recordedNotes = notes;
for
pkInstance.recordedNotes = notes;


The class appears imported (found in the main.as)

package
{
      import piano.PianoKeyboard;
You shouldn't be using the instance name the same as the class name.
var pianoKeyboard:PianoKeyboard = new PianoKeyboard();  

Open in new window

Is that recordedNote a public array that you can access?

What error message do you get? Can you copy and paste along with the offending line that your debugger tells where the problem is?

CyanBlue
Any update?

CyanBlue
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.