C:\ Home » Blog » Code » The Root Of The Problem

The Root Of The Problem

I had a jam game today. Deadline at midnight. Hoped I'd get it done way before then (I'm actually typing in this post around 5 PM - still have barely made it past the interface design - writing this a little ahead of time) but of course it's probably going to be done at the last moment possible...

Technically I have a few hours extra before midnight EST, but work awaits tomorrow and I didn't sleep well last night (tailbone pain all of a sudden, can't lie on my back - can't lie easily on my sides either - very problematic) so I really don't want to stay up that late if I can help it.

This is all beside the point though. Neither here nor there. Nor over there. Nor anywhere.

But anyway, the point is: I think I finished up my interface bit about an hour or so ago. Maybe even earlier. A complex mash-up of movie clips and tweens and buttons as to give the game a floating kind of feeling (you'll see if you play it) and the only thing that remained was adding in some actions to those buttons to direct the users to the relevant frames within said game... and it just wouldn't work! I used an action I'm pretty sure I've used plenty of times before, namely:


...but it just didn't happen! Nothing happened when you pressed it.

I tried copying the button outside the movieclip it was embedded in.

I tried copying it outside the additional movieclip it was embedded in within that (had one for a rotating question mark in addition the wave FYI).

I tried swapping out _root for _parent, and adding in the scene number along with the frame, and adding in a frame name instead of the number, and then actually copying the button outside the movieclip and removing that _root bit there... and suddenly it worked fine.

What's the problem? _root is an accepted parameter, so why wouldn't that work?

I've been looking through code examples and tutorials and what-not trying to figure this out, wondering if maybe a button can't be clickable within a tween, or with layered MCs, or with too many MCs on the same frame, or if there was maybe a problem with the MC name (it had a space in it, could that be it?). Tried applying the code to the MC itself instead of the button too. The MC doesn't play then, but debug doesn't say there's anything wrong with it, might actually work with button actions on an MC - finna need to test that a bit further some other time.

In the end though I settled for a working workaround. I cut out the _root bit of it all, and instead just added in a regular gotoAndPlay within the MC, beyond the last frame of the loop, with this:




...on the last frame of the loop, as to keep it looping seamlessly without automatically taking the user to the aforementioned frame in the root of all should the user not click said button.

And it worked! For some reason it works when the action's applied to the frame itself, but not when it's applied to the button.

I'm battled, and slightly frustrated I spent one or two hours on this tiny thing, but that's that. And that's it for writing/spending all the more time on this thing that I don't really need to spend time on. It's functional though. Documentation and vent in one.

Now onto the rest of that game...


Keep track of the discussion via rss? Read about comment etiquette? Or type in something below!
This was pretty damn interesting. And yet, nobody's spoken! Be the first!

The Comment Form

Your email address will not be published. Required fields are marked *

Your email is saved only to approve your future comments automatically (assuming you really are a human). ;) It's not visible or shared with anyone. You can read about how we handle your info here.

Question   Razz  Sad   Smile  Redface  Biggrin  Surprised  Eek   Confused   Cool  Mad   Twisted  Rolleyes   Wink  Idea  Neutral

Privacy   Copyright   Sitemap   Statistics   RSS Feed   Valid XHTML   Valid CSS   Standards

© 2021
Keeping the world since 2004.