-
MovieClips array?
I'm creating multiple movieclips, containing a TextField and an image as a background. In order to keep track of them I'm storing them in an array. The problem is that I can't add the movieclip to the screen >.<
What I'm doing is
PHP Code:
addChild(movieclips[0]);
but it's not displaying. I know it's not the movieclip as I can addChild that and it shows, but trying to call it out of the array is not working and it's REALLY frustrating the nark out of me
How do I add the selected movieclip out of my array?
-
If it's not throwing an error then they are being added. Are you sure the container that is calling addChild is actually on the stage?
-
it is the stage.
When I addChild(movieclip) it works (it's in a loop so I get all the movieclips on stage at once), but when I try to get just one out of the array I get an empty screen
-
I'm doing exactly the same in a loop with buttons in an array "addChild(someArray[i]);" and it works perfect. Maybe you should post some more of your code?
-
I think I sorted it.
pseudo-code:
for each page,
movieclip:MovieClip = new MovieClip
load page gubbins into movieclip
save movieclip to array movieclips
-
add movieclips[0] to stage.
The problem, as I can work it out, is that movieclip is a local variable and was being over-written, regardless of being added to the array at the end of each loop. The fix I used was to name the movie clips movieclipn where n is the loop number, and instead of keeping track of it in an array I just added all movieclips to the stage, keeping the ones I didn't want to see off the screen.
Not the best solution, but it works...
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|