tarafenton
02-10-2009, 09:27 PM
I've been struggling with this for several days now and no post or reference has helped. I originally created a project in the Flash IDE, but started to become overwhelmed with the size of the project and have been told to migrate over to Flex as an editor.
So I am starting over by added pieces of the code little by little so I can narrow where the errors originate. What I have been struggling with is getting a MovieClip added to the display. I think it may be because the MovieClip is null - not created yet (at least that is what I have seen in other posts that go with this error) But I do a trace after the MCs are created and they trace out correctly. I look in the debugger, but I don't know what I am looking for besides name and parent seems right to me.
private function pageHolder():void {
for (var i:int=0; i < this.myArray.length; i++) {
//set up single page layers
singleHolder=new MovieClip ;
singleHolder.name="page" + i;
singleImage=new MovieClip ;
singleImage.name="imageMC";
singleLetter=new MovieClip ;
singleLetter.name="letter";
singleHolder.addChild(singleImage);
singleHolder.addChild(singleLetter);
singlePages.addChildAt(singleHolder,0);
}
}
Then later on in the code
private function checkToContinueLetter():void {
MovieClip(singlePages.getChildByName("page1")).MovieClip(getChildByName("imageMC")).addChild(MovieClip(singleImage_arr[1]));
}
Throws up... TypeError: Error #1006: MovieClip is not a function.
I should note that
MovieClip(singlePages.getChildByName("page1")).addChild(MovieClip(singleImage_arr[1]));
works for some reason, but it is not where I want to add the child. I need to add it to the imageMC not page.
PLEASE HELP!!!
Any advice on the debugger, migration from Flash IDE to Flex, adding displayObjects to the document class through classes? I need all the help you can give, even if it is just a suggestion.
Thanks
So I am starting over by added pieces of the code little by little so I can narrow where the errors originate. What I have been struggling with is getting a MovieClip added to the display. I think it may be because the MovieClip is null - not created yet (at least that is what I have seen in other posts that go with this error) But I do a trace after the MCs are created and they trace out correctly. I look in the debugger, but I don't know what I am looking for besides name and parent seems right to me.
private function pageHolder():void {
for (var i:int=0; i < this.myArray.length; i++) {
//set up single page layers
singleHolder=new MovieClip ;
singleHolder.name="page" + i;
singleImage=new MovieClip ;
singleImage.name="imageMC";
singleLetter=new MovieClip ;
singleLetter.name="letter";
singleHolder.addChild(singleImage);
singleHolder.addChild(singleLetter);
singlePages.addChildAt(singleHolder,0);
}
}
Then later on in the code
private function checkToContinueLetter():void {
MovieClip(singlePages.getChildByName("page1")).MovieClip(getChildByName("imageMC")).addChild(MovieClip(singleImage_arr[1]));
}
Throws up... TypeError: Error #1006: MovieClip is not a function.
I should note that
MovieClip(singlePages.getChildByName("page1")).addChild(MovieClip(singleImage_arr[1]));
works for some reason, but it is not where I want to add the child. I need to add it to the imageMC not page.
PLEASE HELP!!!
Any advice on the debugger, migration from Flash IDE to Flex, adding displayObjects to the document class through classes? I need all the help you can give, even if it is just a suggestion.
Thanks