Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Problem with classes

Posted on 2012-03-28
7
244 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
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

This is intended to introduce all collision detection principles in flash, their strengths, weaknesses and workarounds. The main method for Collision Detection in flash is using hitTestObject. But unless you'll be pushing rectangular shapes without …
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…
The goal of the tutorial is to teach the user how to how to load their YouTube profile onto Flash Media Live Encoder.
The goal of the tutorial is to teach the user how to set there setting in Adobe Flash Media Live Encoder and YouTube for optimal video and audio quality.

839 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