Brick Breaker Tutorial Help

8 posts

Flag Post

I am using this tutorial to try to learn Flash:

The problem I am is that when I test the game, I get an error that says “access of undefined property mcPaddle”. I tried using the example file to see what I did wrong, and got to the point in which I directly copied the code and mcPaddle to my file, and it still would say “access of undefined property mcPaddle”, even though the other file worked fine. Does anyone know what I might be doing wrong?

Flag Post

That means the code can’t find a mcPaddle. Mebe a typi (mcpaddle !=mcPaddle), or mebe ya haven’t added mcPaddle yet….I suspect it’s the later because that tutorial doesn’t seem clear to me on that point. Try adding

private var mcPaddle:MovieClip=new MovieClip();

at line 14. (just before beginCode();)

Instead of manually drawing & adding it to stage.

Of course you still need to draw it & add it, and I’d have it as a Sprite rather than a MC, but check if that fixes your error.

Flag Post

Sorry, That doesn’t seem to work :/. When I put that in, I get the error “the private attibute may be used only class property definitions”(not exactly sure what that means).

At the bottom of the page there’s a “download source” button, which gives you an example file up to that point in the tutorial. I downloaded that when I couldn’t figure out what was wrong, and copied the mcPaddle movieclip to my file, as well as the code. It works fine on the source file, but when on my file, it doesn’t seem to work at all! I just really can’t figure out what I might be doing wrong.

Flag Post

Oh that’s my bad…..I’ve never used FlashPro :/

Try deleting the word private….

The point is the code doesn’t think mcPaddle exists, or know what it is/should be. I don’t know how Flashpros drawing things and making them instances works, so try defining mcPaddle in code, before the code needs to know what it is. Mebe that tutorial is all good for FlashPro, but it doesn’t look great to me because it’s vague on this point. I think it wants you to manually place the paddle on stage, but it doesn’t actually tell you to that I saw….

Flag Post

That doesn’t seem to work either. Honestly, I’m not even sure if there is anything wrong with the code at all, as it works fine in the example file. I think perhaps the tutorial might be a bit outdated, so I’m trying to contact the tutorial creator to see what the problem might be. Hopefully I can get a response. Thanks for your help though!

Flag Post

the private attibute may be used only class property definitions

You are putting that in the wrong place then. That said, the whole tutorial isn’t a super great one – teaching you to code on the timeline.

To solve your problem, you should follow this part:

Next, we’re going to give the paddle an instance name, mcPaddle. The instance name is case sensitive, so type it exactly the way I did.

Flag Post

Funnily enough, I just happened to figure that out a few minutes ago. I think the problem I was having was that it shows that part right after showing converting it to a movieclip, and since I’m new, I didn’t really know the difference between the two enough to know that he was talking about something entirely different. Thanks!

Flag Post

Read this