Problem with classes

Hi there,

I'm nearing the end of my Web Imaging and Animations course for the semester.  Tweening and masking seemed pretty easy but as soon as we started Actionscript I started having some trouble.

Our latest lab involves creating a basic Flash game.  Balloons fall and the user has to click the balloons to pop them.  I had the balloons falling after I downloaded an example .FLA for falling snow.  It used a document class though.  The problem is that I need the game to run when on the second frame, not when the .FLA is compiled as a whole.

You can see the balloon part when you compile the current version of it.  I need this to happen only after the 'start' button is clicked.

Any considerations would be much appreciated

Here's a link to the project files :

Project Files
duder78Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

blue-genieCommented:
first of all when you compile your file, you'll see you get compile time errors.

Definition com:Balloon could not be found.

You seem to have confused your document Class - with the balloon.
if you specify Balloon as your document class - that is what will happen - as soon as the file loads - your balloon will be instantiated.

What i would recommend you do, instead of combining timeline code with an AS code - create a Main class - use that as the "Controller" for your game - set it as your Document class. Include the start btn code etc in there.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
duder78Author Commented:
Allright,  I scrapped what I had and started over.  I definitely think that I've made progress but I've hit a snag again.  In the third frame I loop through the children in an attempt to clear the stage (signifying the end of the game) but only a few of the bubble disappear leaving 4 or 5 still drifting towards the bottom.  

I thought that this block of code should work but it doesn't :

for(var i = 0; i < numChildren; i++)
{
	if(i > 2)
	{
		if(getChildAt(i) != null)
		{
			removeChildAt(i);
		}
	}
}

Open in new window


Knowing that getChildAt(0). (1) and (2) are the buttons and score text field, I want to leave them alone hence the if(i > 2) .

So, my main problem is removing all the bubbles from the stage in frame 3.  I also can't get the score to update properly if anyone wants to take a look but it's not a big deal.

Thanks for any considerations

Here's the most recent version of the bubbles project :

Bubbles TAKE TWO
0
blue-genieCommented:
ok will have a look at it and revert - might have to wait till the weekend if someone doesn't have a go before then.
0
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

duder78Author Commented:
No rush blue genie!  Thanks..
0
dgofmanCommented:
You have to remove "com" from your import. You didin't define a package name in Ballon.as class

import Balloon;

var balloon:Balloon = new Balloon();
addChild(balloon);
0
CyanBlueCommented:
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Adobe Flash

From novice to tech pro — start learning today.