bigarth
June 19th, 2007, 01:22 PM
allow me to set up the situation. i have created three movieclips that are in the library. the first movieclip is called Beat and has been linked to an actionscript class Beat. i have added a second movieclip inside the Beat movieclip that is called light (the instance name is light). The third movieclip is called BeatBar and is linked to class BeatBar. both the Beat and BeatBar classes extend MovieClip.
after adding a BeatBar to the stage via AS and adding children Beats to that BeatBar (addChild), i am attempting to access the light movieclip that is inside the Beat movieclip. I have placed this code inside a function in the BeatBar class:
getChildAt (current_beat).getChildByName ("light").visible = true;
current_beat is a number referencing a particular Beat inside the BeatBar. However, when i try to run the code, i get the error:
1061: Call to a possibly undefined method getChildByName through a reference with static type flash.display: DisplayObject. (i added a space before DisplayObject to disable the smiley)
i have tried importing flash.display.DisplayObject. i have tried assigning variables to each of the getChild calls instead of doing it on one line, such as:
var target: DisplayObject = getChildAt (current_beat); (added space to get rid of smiley)
target.getChildByName ("light").visible = true;
but that still throws the same error. this is my first time coding in AS3 and i'm at a loss as to why this isn't working the way i assume it should. any help would be greatly appreciated.
after adding a BeatBar to the stage via AS and adding children Beats to that BeatBar (addChild), i am attempting to access the light movieclip that is inside the Beat movieclip. I have placed this code inside a function in the BeatBar class:
getChildAt (current_beat).getChildByName ("light").visible = true;
current_beat is a number referencing a particular Beat inside the BeatBar. However, when i try to run the code, i get the error:
1061: Call to a possibly undefined method getChildByName through a reference with static type flash.display: DisplayObject. (i added a space before DisplayObject to disable the smiley)
i have tried importing flash.display.DisplayObject. i have tried assigning variables to each of the getChild calls instead of doing it on one line, such as:
var target: DisplayObject = getChildAt (current_beat); (added space to get rid of smiley)
target.getChildByName ("light").visible = true;
but that still throws the same error. this is my first time coding in AS3 and i'm at a loss as to why this isn't working the way i assume it should. any help would be greatly appreciated.