Solved

Problem with classes

Posted on 2012-03-28
7
235 Views
Last Modified: 2012-04-28
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
0
Comment
Question by:duder78
7 Comments
 
LVL 39

Accepted Solution

by:
blue-genie earned 250 total points
ID: 37780561
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
 

Author Comment

by:duder78
ID: 37785118
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
 
LVL 39

Expert Comment

by:blue-genie
ID: 37785932
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
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 

Author Comment

by:duder78
ID: 37789709
No rush blue genie!  Thanks..
0
 
LVL 29

Assisted Solution

by:dgofman
dgofman earned 250 total points
ID: 37791263
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
 
LVL 37

Expert Comment

by:CyanBlue
ID: 37905390
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
0

Featured Post

Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Failed download 57 564
How  to reduce the .AVI file size of 90GB 4 351
HTML 5 video and audio or Flash 1 57
Flash ActionScript 6 53
Recently, I was asked to recommend a tracking system to be implemented on a clients website. As the entire site was built on flash, my first thought was to suggest custom built tracking system. However, our company at that point of time didn't h…
I have found that much of my time doing support ends up being a constant repetition of the same steps to different people.  Early on I stated using web pages with Frequently Asked Questions (FAQs) to alleviate most of the burden.  Sometimes this jus…
The goal of the tutorial is to teach the user how to live broadcast using Flash Media Live Encoder and connecting it to YouTube to broadcast. Log into your Youtube account, choose live stream settings, start live stream from Flash Media Live Enc…
The goal of the tutorial is to teach the user what frame rate is, how to control it and what effect it has on the video.

803 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question