Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Problem with classes

Posted on 2012-03-28
7
Medium Priority
?
265 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
[X]
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
7 Comments
 
LVL 39

Accepted Solution

by:
blue-genie earned 1000 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

Author Comment

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

Assisted Solution

by:dgofman
dgofman earned 1000 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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 …
In my long career of working as an actionscript developer, I had spent sleepless night often working hard to solve some small problems which actually took a lot of my development time; later found out the solutions to be a line or two. Here are s…
The goal of the tutorial is to teach the user how to select the video input device. Make sure you have an input device that in connected and work and recognized by Adobe Flash Media Live Encoder and select it in the “video input” menu.
The goal of the tutorial is to teach the user how to select which audio input to use. Once you have an audio input plugged into the laptop or computer, you will go into the audio input settings and choose which audio input you want to use.

604 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