Copy link to clipboard
Copied
So this is the dress up game :
Wip - shadowphoenixfox's Sta.sh
and as you can see if you add too many items things just kinda go missing.
Why does it do this and how can I fix it?
Also I'm very much new to adobe animate and actionscript so maybe it's something wrong with the code
I'm not sure if it's related but I've been getting the error;
ReferenceError: Error #1056: Cannot create property buttonMode on flash.display.SimpleButton.
at wip_fla::hair_panel_1/frame3()
at flash.display::MovieClip/gotoAndStop()
at wip_fla::hair_panel_1/btn3()
I didn't pay too much attention to it because A. I couldn't figure out what was wrong and B. I don't know how to fix it, but could this have something to do with it? btn3 is this by the way
shirtbtn.addEventListener(MouseEvent.CLICK, btn3);
function btn3(event:MouseEvent):void{
gotoAndStop(3);
}
its not really any different from my other buttons so I don't understand. If I get rid of the btn3 code it gets rid of the error but I still get the glitch so they're probably not related.
i don't see a problem. there's probably a problem with your computer/video memory.
Copy link to clipboard
Copied
you're using something like shritbtn.buttonMode somwhere and that's triggering that 1056 error.
click file>publish settings>swf and tick 'permit debugging' and retest.
the problematic line number will be in the error message.
Copy link to clipboard
Copied
Alright Thank you! I managed to fix the 1056 error, seems there were two buttons that were meant to be movie clips oops
However I'm still getting the main issue of the game glitching out when I stack too many items
Copy link to clipboard
Copied
i've never seen a problem with too many items on stage (other than performance). more likely you're mismanaging depths.
do you ever user removeChild() or addChildAt()?
Copy link to clipboard
Copied
I might be misunderstanding here but I haven't used the code removeChild() or addChildAt() at all. Everything's within three depths (the whole scene, movie clip for each category(shirts,shoes ect and the index) and then the actual specific item or icon) All the coding's within the middle depth
Copy link to clipboard
Copied
you’re using more than 3 depths and your misunderstanding of that may be all or part of the problems you’ seeing.
Copy link to clipboard
Copied
yes that doesn't surprise me I'm really new to this after all. If it's not too much trouble could you please explain
Copy link to clipboard
Copied
here's info on depths, https://code.tutsplus.com/tutorials/as3-101-the-display-list-basix--active-2255
but, while i suspect that's the problem, i'm not certain that's the problem. you could use the trace function to see what's happening to your objects that 'disappear'.
Copy link to clipboard
Copied
okay totally noob question but how does one use the trace function?
I think I see what you mean about depths but seeing as I haven't altered any of the depths by code shouldn't they be working fine just through layers and arrangement or am I totally misunderstanding how animate works?
Copy link to clipboard
Copied
you have to do some manipulation or else dragged objects will be behind other objects. usually you want them to be on top.
are you dragging objects?
Copy link to clipboard
Copied
nothing is dragged everything is put on through clicking a corresponding icon. I'm using variations of this code on all the icons so they will put on the clothing on the doll
import flash.events.MouseEvent;
var myHairArray = [down, buns, pigtail, plaits];
for each (var Hair in myHairArray) {
Hair.addEventListener(MouseEvent.CLICK, onHairClick);
Hair.buttonMode = true;
}
function onHairClick (event:MouseEvent):void {
MovieClip(parent).hair_mc.gotoAndStop(event.target.name);
}
so the depth shouldn't be changing as you play
Copy link to clipboard
Copied
then you're not adding anything to the stage that's not on stage with your swf starts. what makes you think there's a problem "..when too many items are added"?
Copy link to clipboard
Copied
um lets see if I can explain. there's at least one movieclip for each category of clothing (some have more if I need them to be on top of and behind the doll) and while they are all on stage all the time most are on a frame with nothing in it by default but if you make too many of the movie clips go to a frame with something in it then layers starts going missing and I know it's not just the movieclips resetting to default because first to go missing is a static rectangle that's usually behind the doll and half the first column of buttons which are closest to the doll something that's never meant to disappear (and in any case its weird that only half the button disappears anyway) then the hair goes missing which doesn't have a frame with nothing in it and then the doll which Isn't even a movieclip just a static object. Depending on what item of clothing is used, the back layer of the item can also go missing. So when I say "..when too many items are added" I just mean when it looks like items are added in the game. In theory they should all be there all the time but obviously I can't really tell if they're there or not when they are meant to be on a frame with nothing in it anyway. Hope that makes sense
Copy link to clipboard
Copied
upload your fla and post a link.
Copy link to clipboard
Copied
Copy link to clipboard
Copied
i don't see a problem. there's probably a problem with your computer/video memory.
Copy link to clipboard
Copied
thank you for trying to help I'll take your word for it but I don't have another computer to test that theory on at the moment so I guess I'll give up for now
Find more inspiration, events, and resources on the new Adobe Community
Explore Now