PDA

View Full Version : Object methods



kimmykool
08-07-2004, 08:21 AM
I am having greif with a game I am writing in Flash that I have previously written in VB, and DIV.

I create an (alien) object as a flash movie clip. The alien is controlled by a switch statement contained within each alien.
e.g.
switch (mode)
{
case "leave mother ship":{some function};
case "return mother ship":{some function};
}
I have created a function in the root of the alien called 'set mode' (this.mode="leave mother ship")but it seems to be private and inaccessible.
I now need to tell the alien from the outside to switch mode.
Any help, tips or ideas much appreciated.

ivr
08-10-2004, 07:45 PM
Hi Kimmy, I am not up with flash but run swish which makes swf files.
If you try putting a stop and then a play then a stop then a play and so on in the scene timeline, then place your alien in the first play then a remove in the timeline on a stop at least three places forward.
Make a command to to go to that point on the timeline to make your animation play

compumonster
08-12-2004, 01:44 AM
Hi Kimmy, your code is not very specific, so I won't check the sintax (anyway, I haven't a very good memory for commas) but I dare to think that your problem is the "mode" variable in the "switch(mode)" sentence. You have to put global variables in a place where functions can find it. Normally in "root". So check if its in "root" and address to it properly. That's "switch(_root.mode)".

kimmykool
08-12-2004, 05:46 AM
Many thanks compumonster, you hit the nail on the head

compumonster
08-13-2004, 12:50 AM
You're welcome, Kimmy. Have a nice day.