iEntry 10th Anniversary Webforumz RegistrationAnnouncements Contact Webforumz StaffContact
Home Resources Blogs Meet the Team Contact Register
 

Go Back   WebForumz.com > The Visual Design > Flash and ActionScript

Reply
 
LinkBack Thread Tools
Old April 1st, 2008, 11:43 PM   #1
Reputable Member
 

Join Date: May 2007
Location: Tamworth
Age: 32
Posts: 117
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Altering Power: 0 cocoonfx is on a distinguished road
Help! Flash CS3 - Combo Boxes with formulas

Hello


I am trying to get a stupid combo box to work in flash cs3. All i want to do is have a couple of combo boxes which when i select an option it then performs a calculation.

i.e

Combo 1 = Age

10 - 15

Combo 2 = Gender

Male

The formula

If (Combo 1 == "10 - 15" && Combo 2 = "Male"){
answer.text = 10*10;
}

I have managed to create a combo box which when i select the Gender i can get the answer.text to show Male or Female, but i can not get the formula to work and then when i add a second combo box the who .fla comes up with errors.

Before in Action script 2 i can easily do formulas i.e

var cal:Number=Number(10*10);
var sum=cal;

but i want to use Action script 3.

Does anyone know where i can find a tutorial which uses a combo box to do a formula or can any one assist?

Here is the code i am using at the moment:

import fl.controls.ComboBox;
import fl.data.DataProvider;



var sGender:Array = new Array(
{label:"Male",
data:"Male"},
{label:"Female",
data:"Female"}

);



var aCb:ComboBox = new ComboBox();
aCb.dropdownWidth = 100;
aCb.width = 100;
aCb.move(208, 46);
aCb.prompt = "Gender";
aCb.dataProvider = new DataProvider(sGender);
aCb.addEventListener(Event.CHANGE, changeHandler);

addChild(aCb);

function changeHandler(event:Event):void {

if(aCb.value =="Male"){

txttest.text="Male" ;
}
if(aCb.value =="Female"){
txttest.text="Female";
}

}
cocoonfx is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
6-level combo boxes Phoenix1664 JavaScript 2 March 21st, 2007 10:22 AM
How do I add a GO button to these multi combo boxes? Andy K JavaScript 4 July 29th, 2005 05:03 PM
grabbing data from combo boxes benbacardi Classic ASP 2 January 25th, 2005 10:46 AM
Annoying Linked Combo Boxes!! Hangs Classic ASP 7 May 25th, 2004 04:21 AM


Search Engine Optimization by vBSEO 3.2.0 RC8