vendredi 10 juin 2016

Access textbox inside a movieclips child

I'm trying to access a textfield inside a movieclips child. The "main" MC is called 'dagArray[i]'. The code beneath adds 4 of the same MC (the "childs") to the "main" MC, each one of them with a textfield called 'fagNavn'

import flash.display.MovieClip;
var startX = 0;
var startY = dagNavn.height;
var timeArray:Array = new Array();
for(var i:int=0;i<4;i++)
{
    var mc:timeMal = new timeMal();
    mc.x = startX;
    mc.y = startY + mc.height*(i);
    addChild(mc);
    timeArray[i] = mc;
}
timeArray[0].fagNavn.text = "test1!"

The "test1!"-text is showing, but I can't access the textfield/change the text from the main codeblock, where I added the "main" MCs. I've tried

dagArray[0].timeArray[0].fagNavn.text = "TEST";

But that just returned Error#1009, 'can't access a null...'.

Thanks in advance for any help

Aucun commentaire:

Enregistrer un commentaire