combobox labels to movieclip frames that are on same frame as3

184 views Asked by At

Hi i am making an android app on Flash cs5 which will be a helper for an "mmorpg" game. in this app i have 3 buttons named flux, naptha and food flavor, which lead to a list of 11 comboboxes named cb1-11. this buttons work on same frame (they clear the list of each combobox and add theres), on each combobox there are 67 labels. on the same frame there are 11 movieclips namend mv1 - 11 which have 67 frames each.

what i want to do is to make each label to gotoAndStop on spesified frame in the movie clip. I also want to make the application save the data so that the user will be able to load his list agen. Oh and i cant seem to make an exit buton work.

p.s. i am a beginner in Actionscript 3.0 so i would rather have my answer explained in detail.

here is an example of one of the comboboxes.

import flash.events.MouseEvent;

function fluxList():void {

cb1.addItem( { label: "Choose Herb" } );
cb1.addItem( { label: "Acerba Moretum" } );
cb1.addItem( { label: "Adipem Nebulo" } );
cb1.addItem( { label: "Albus Viduae" } );
cb1.addItem( { label: "Aquila Peccatum" } );
cb1.addItem( { label: "Aureus Magistrum" } );
cb1.addItem( { label: "Bacce Hamsa" } );
cb1.addItem( { label: "Burmenta Wallo" } );
cb1.addItem( { label: "Caeci Costos" } );
cb1.addItem( { label: "Chorea Iram" } );
cb1.addItem( { label: "Curaila Jangha" } );
cb1.addItem( { label: "Curva Manus" } );
cb1.addItem( { label: "Desertus Smilax" } );
} 


function fluxbtn (event:MouseEvent):void{   
cb1.removeAll();
cb2.removeAll();
cb3.removeAll();
cb4.removeAll();
cb5.removeAll();
cb6.removeAll();
cb7.removeAll();
cb8.removeAll();
cb9.removeAll();
cb10.removeAll();
cb11.removeAll();
fluxList();
stadict.text = "My FLUX List";
}
flux_btn.addEventListener(MouseEvent.CLICK, fluxbtn);

var font:Font1=new Font1();

var myFormatBlack:TextFormat = new TextFormat();
myFormatBlack.font = font.fontName;
myFormatBlack.size = 24;
myFormatBlack.color = 0xFFFFFF;

cb1.textField.setStyle("embedFonts", true);
cb1.textField.setStyle("textFormat", myFormatBlack);
cb1.dropdown.setRendererStyle("embedFonts", true);
cb1.dropdown.setRendererStyle("textFormat", myFormatBlack);
cb1.setStyle("embedFonts", true);
cb1.setStyle("textFormat", myFormatBlack);
cb1.width = 269;
cb1.height = 36.30;
cb1.x = 39.75;
cb1.y = 321.05;
cb1.setStyle("textPadding", 1);

i would appreciate a solution as soon as possible.

Thanks in regards [example of frame 38]

https://i.stack.imgur.com/pG4C0.jpg

1

There are 1 answers

4
Sean Carroll On

as far as i know exit button isnt possible in flash / air apps.

To gotoAndStop on a specific frame within a MC, use something like

root.YourMC.gotoAndStop("NamedFrameWithinMC");

or

root.YourMC.gotoAndStop(1);

as for saving user choices there are many ways to do so.

a great example of how to do so using AS3 SharedObject Class http://www.republicofcode.com/tutorials/flash/as3sharedobject/

search around StackOverflow for other methods if needed there are many options that work well.

Also make sure You have added.

import fl.accessibility.ComboBoxAccImpl; 
ComboBoxAccImpl.enableAccessibility();

you could use label & data & variables. create a change listeners & function

flux_list.addEventListener(Event.CHANGE, changeHandler); 
function changeHandler(event:Event):void 
{
   var MyVar = myComboBox.selectedItem.data; 

   if (MyVar == 1)
   {
      root.YourMC.gotoAndStop(MyVar);
   }
   if (MyVar == 2)
   {
      root.YourMC.gotoAndStop(MyVar);
   }
}

and in your Combobox creation ad data field to use in above code eg.

cb1.addItem( { label: "Choose Herb", data:"1" } );

some docs worth reading are: http://help.adobe.com/en_US/ActionScript/3.0_UsingComponentsAS3/WS5b3ccc516d4fbf351e63e3d118a9c65b32-7fa9.html

and

http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/fl/controls/ComboBox.html

Hope this helps.