PDA

View Full Version : what is the best practice for making a .fla file that is going to have a bunch of sma


ewaite
01-29-2009, 01:15 AM
Hi, I am new to actionscript and the forum. I am not sure this is a newbie question though. What I am wondering is, what is the best practice for making a .fla file that is going to have a bunch of small little games together.

I am trying to program a few different little games within one FLA file. The problem is there is only one document class file. I have frame level actionscript code that is referencing code in the document class file. Things like button listeners. This all works as a standalone game with one document class file. What I would like to do is to create a new document class file which has that game as a variable that can be accessed by the fla frame functions.

public class Game extends MovieClip {

var subGame:SubGame= new SubGame();

public function Game() {
}

In the .fla file
operationComboBox.addEventListener("change", subGame.operationClickHandler);

This gives me an error:
1178: Attempted access of inaccessible property operationClickHandler
through a reference with static type subGame:SubGame.

Do you have any suggestions? Should I be laying things out differently?
Should I be adding all the buttons and text by code?

Thanks.

Eric

memoorthy
02-02-2009, 10:07 AM
I am not really getting wat u r trying to do... anyhow .. the reason for the error would be coz u r trying to initialize the member before the class object is even created. Move the var subGame:SubGame= new SubGame(); inside the constructor to avoid error.

try describing your requirement again.. let me see if i can help you.