Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 08-06-2007, 04:45 AM   #1
Registered User
Join Date: Aug 2007
Posts: 6
Default Building Games in Flash Tutorial -> duplicatemovieclip() problem


The problem below was solved, but for some reason I have encountered another problem. This time with the duplicatemovieclip(). The tutorial. I was able to get the collision hit test to work.
this.onEnterFrame = function() {
        if (box_mc.hitTest(ball_mc._x, ball_mc._y)) {
But the code afterwards where it registers the collision then duplicates the balls, doesn't seem to function for me. However, as before, I copied and pasted my own code while I was following the tutorial, into the source file and it worked. What am I doing wrong again? Thank you.

You can find my .fla file here .


I had tampered with flash a few years back, but I'm new to action script, and rusty with some of the basics in flash.

I have a question that I think should be very simple, but I can't seem to figure out why it doesn't work. Basically I was following this tutorial, "Building Games in Flash" , but I got stuck at a certain point.

Where I'm having trouble with is the directions before this block of code
function moveStuff() {
        if (Key.isDown(Key.LEFT)) {
                this._x -= 5;
        if (Key.isDown(Key.RIGHT)) {
                this._x += 5;
        if (Key.isDown(Key.UP)) {
                this._y -= 5;
        if (Key.isDown(Key.DOWN)) {
                this._y += 5;
box_mc.onEnterFrame = moveStuff;
ball_mc.onEnterFrame = moveStuff;
I had created the box and the ball, and made them movieclips, but for some reason, when I use the code and hit cntrl-enter to run, the objects just won't seem to move. I had downloaded the source file, and just copied and pasted the code I had used while I was following the tutorial (my flash file) into the source file and the objects in the source file seem to move just fine.

What might I be doing wrong?

Here's my .fla file. http://www.box.net/shared/ppyrflm4yr


Last edited by goldentaiji; 08-07-2007 at 01:13 PM.
goldentaiji is offline   Reply With Quote
Old 08-06-2007, 07:45 AM   #2
Registered User
Join Date: Aug 2007
Location: I live in Alaska.
Posts: 4

1) Be sure "box_mc" and "ball_mc" both have instance names.
2) Do you have a one-frame movie? The onEnterFrame event will only fire off once with a one-frame movie. Try adding a second frame and the playhead will loop between frames 1-2.
eric_of_alaska is offline   Reply With Quote
Old 08-06-2007, 01:45 PM   #3
Registered User
Join Date: Aug 2007
Posts: 6

eric_of_alaska - It was the instance name. I had thought that the "Name:" for the mediaclip was also the instance name that was being referred to in the tutorial. Thank you so much.
goldentaiji is offline   Reply With Quote
Old 08-07-2007, 01:15 PM   #4
Registered User
Join Date: Aug 2007
Posts: 6

I have encountered another problem, please see the edit in the first post. Unfortunately I cannot change the title of the thread, but I did not want to clutter the forums with threads with relatively simple problems.
goldentaiji is offline   Reply With Quote
Old 08-07-2007, 04:31 PM   #5
Registered User
Join Date: Jun 2007
Posts: 54

It should be "newBall = ball_mc.duplicateMovieClip('ballCopy' + i, i++);"
instead of "newBall = ball_mc.duplicatemovieclip('ballCopy' + i, i++);"

Me thinks the guy who wrote that tutorial got the syntax wrong, which is kinda weird, all things considered.
whizkid1990 is offline   Reply With Quote
Old 08-11-2007, 12:10 AM   #6
Billy T
Oops I did it again
Billy T's Avatar
Join Date: Oct 2001
Location: Melbourne
Posts: 8,579

appears to be a problem with the as.org cms

lots of it has gone lower case - attachmovie as well

fine in the original

Online Galleries
iPhone Safety App - iStaySafe
Free Flash Video Tutorials
Photo Website Template

Don't email or PM me questions...
Billy T is offline   Reply With Quote

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem: Flash takes over browser resources Das123 ActionScript 1.0 (and below) 2 05-19-2004 08:14 PM
Flash MX (PHP) Remoting tutorial (simple problem) edeustace Server-Side Scripting 0 02-16-2004 07:46 PM
Flash MX seminar Tink ActionScript 1.0 (and below) 5 03-17-2002 04:41 AM

All times are GMT. The time now is 04:47 PM.

Follow actionscriptorg on Twitter


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.