Skip to main content
Known Participant
January 25, 2013
Answered

WORKING WITH TIMELINES

  • January 25, 2013
  • 2 replies
  • 559 views

Hi

I have a game designed in flash using the Object Oriented Approach. This implies I have various classes with a main class.

I also have two versions of the game collaborative and non-collaborative which can be palyed using three different game controllers. so in total I have 6versions as shown below:

collaborative palyed with gamepad

collaborative played with wiimote

collaborative played withbalance board

non- collaborative palyed with gamepad

non-collaborative played with wiimote

non-collaborative played withbalance board

Now I want to have a screen with links to all these verions for example when I run the game I want to get an intro screen with the versions written on it and then with button clicks play the particular version I want.  Can I do this on the Timeline. if possible what is the procedure?

This topic has been closed for replies.
Correct answer kglad

in your new main swf:

var loader:Loader=new Loader();

addChild(loader);

var a:Array=[collaborative_palyed_with_gamepad_btn,collaborative_played_with_wiimote_btn,collaborative_played_withbalance_board_btn,non__collaborative_palyed_with_gamepad_btn,non_collaborative_played_with_wiimote_btn,non_collaborative_played_withbalance_board_btn];  // <-create those movieclip btns

for(var i:int=0;i<a.length;i++){

MovieClip(a).addEventListener(MouseEvent.CLICK,clickF);

MovieClip(a).ivar=i;

MovieClip(a).buttonMode=true;

}

function clickF(e:MouseEvent):void{

var ivar:int=MovieClip(e.currentTarget).ivar;

loader.load(new URLRequest(a[ivar].split("_btn").join(".swf"));  // assuming your swfs are named collaborative_palyed_with_gamepad.swf (sic) etc

}

2 replies

Inspiring
January 25, 2013

Would it not be better to let Flash detect the Input devices automatically, with GameInput ?

That way you can check if the user even has the required Controllers connected and inform him that he needs one of the three Controllers you mentioned.

chiggy83Author
Known Participant
January 29, 2013

Hi thanks for your replies

@moccamaximum I have checked the gameinput out but i think the feature is supported only n AIR for TV devices. Besides, wiimotes connect remotely through a bluetooth so i guess it may not work with wiimotes.

@kglad, could you please, throw more light on your suggestion?

Thanks

kglad
Community Expert
kgladCommunity ExpertCorrect answer
Community Expert
January 29, 2013

in your new main swf:

var loader:Loader=new Loader();

addChild(loader);

var a:Array=[collaborative_palyed_with_gamepad_btn,collaborative_played_with_wiimote_btn,collaborative_played_withbalance_board_btn,non__collaborative_palyed_with_gamepad_btn,non_collaborative_played_with_wiimote_btn,non_collaborative_played_withbalance_board_btn];  // <-create those movieclip btns

for(var i:int=0;i<a.length;i++){

MovieClip(a).addEventListener(MouseEvent.CLICK,clickF);

MovieClip(a).ivar=i;

MovieClip(a).buttonMode=true;

}

function clickF(e:MouseEvent):void{

var ivar:int=MovieClip(e.currentTarget).ivar;

loader.load(new URLRequest(a[ivar].split("_btn").join(".swf"));  // assuming your swfs are named collaborative_palyed_with_gamepad.swf (sic) etc

}

kglad
Community Expert
Community Expert
January 25, 2013

you can (but there's no good reason to do that).

but, if you want, use a loader to load one of the size swfs into a new main swf that contains your intro screen and the loader code.