Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 11-20-2006, 03:11 AM   #1
The Waiter
Registered User
 
Join Date: Dec 2005
Posts: 34
Default Getting a variable from a combobox?

Hello!!

OK - I am experimenting with the flash 8 components for the first time -
In this case the combobox.

I have got my data showing in the output window of flash -
But I just can't work out how to set the variables/record this data as a variable?!


My as is:

var myListener:Object = new Object();
my_cb.addEventListener("change", myListener);

myListener.change = function(evt){
trace("selected item: " +evt.target.selectedItem.data)
}
The Waiter is offline   Reply With Quote
Old 11-20-2006, 03:14 AM   #2
The Waiter
Registered User
 
Join Date: Dec 2005
Posts: 34
Default How do i get a variable from a flash 8 combobox? (for php)

I can get the value from my combobox selection to show up in the output window of flash 8, but just want to know how to capture this variable & send it to php?

var myListener:Object = new Object();
my_cb.addEventListener("change", myListener);

myListener.change = function(evt){
trace("selected item: " +evt.target.selectedItem.data)
}

Any help would be great!!!
The Waiter is offline   Reply With Quote
Old 11-20-2006, 03:23 AM   #3
FlashMech
Flashmech.net
 
FlashMech's Avatar
 
Join Date: Nov 2006
Location: Singapore
Posts: 261
Default

How are you inputing the data? Through AS or by the components parameters?

Maybe if you upload your .fla file it'll be easier.
__________________
Lionel Low
Flash Platform Consultant | Trainer | Speaker
http://www.flashmech.net/
http://www.linkedin.com/in/flashmech
FlashMech is offline   Reply With Quote
Old 11-20-2006, 03:39 AM   #4
The Waiter
Registered User
 
Join Date: Dec 2005
Posts: 34
Default Here is the fla

I have done it via the component box...

See if you can make sense of this!
Thanks
Attached Files
File Type: zip test_box.fla.zip (169.3 KB, 124 views)
The Waiter is offline   Reply With Quote
Old 11-20-2006, 03:46 AM   #5
Cota
Super Moderator
 
Cota's Avatar
 
Join Date: Jul 2001
Location: NYC
Posts: 10,175
Default

have you tried?
ActionScript Code:
trace("selected item: " + my_cb.selectedItem.data);
__________________
Color Wars™ | (kul′ər wôrs) n. - Open conflict between factions. www.theColorWars.com

cota - www.chadworkman.com | http://shavedplatypus.com
occupation: designer | flash developer | server-side developer (php, asp, mssql, mysql)
Cota is offline   Reply With Quote
Old 11-20-2006, 03:52 AM   #6
FlashMech
Flashmech.net
 
FlashMech's Avatar
 
Join Date: Nov 2006
Location: Singapore
Posts: 261
Default

I din't have to make any sense out of it.

It works fine!

What is it that you're trying to achieve anyway?
__________________
Lionel Low
Flash Platform Consultant | Trainer | Speaker
http://www.flashmech.net/
http://www.linkedin.com/in/flashmech
FlashMech is offline   Reply With Quote
Old 11-20-2006, 03:54 AM   #7
Cota
Super Moderator
 
Cota's Avatar
 
Join Date: Jul 2001
Location: NYC
Posts: 10,175
Default

Please do not post the same question multiple times.
__________________
Color Wars™ | (kul′ər wôrs) n. - Open conflict between factions. www.theColorWars.com

cota - www.chadworkman.com | http://shavedplatypus.com
occupation: designer | flash developer | server-side developer (php, asp, mssql, mysql)
Cota is offline   Reply With Quote
Old 11-20-2006, 04:00 AM   #8
The Waiter
Registered User
 
Join Date: Dec 2005
Posts: 34
Default re: variables from combobox -

Hey -

I am basically trying to capture the value of the box selected as a variable - so I can grab it via my php script.
My problem is I'm not sure what to call my variable & where in the actionscript?
My php is like this:

<?

$to = "[email protected]";

$msg .= "Test Value: $_POST[myvariable]\n";

mail($to, $subject, $msg, "From: My web site\nReply-To: $email\n");

?>
The Waiter is offline   Reply With Quote
Old 11-20-2006, 04:18 AM   #9
Cota
Super Moderator
 
Cota's Avatar
 
Join Date: Jul 2001
Location: NYC
Posts: 10,175
Default

Call the variable whatever you like, make it a _root variable. Something like _root.Cb_entry, then send it to the php file when you send the other stuff.
__________________
Color Wars™ | (kul′ər wôrs) n. - Open conflict between factions. www.theColorWars.com

cota - www.chadworkman.com | http://shavedplatypus.com
occupation: designer | flash developer | server-side developer (php, asp, mssql, mysql)
Cota is offline   Reply With Quote
Old 11-20-2006, 04:24 AM   #10
The Waiter
Registered User
 
Join Date: Dec 2005
Posts: 34
Default

OK... cool.
But where do I mention my variable in the string of code? ;-/
I am so close - i can smell it.



var myListener:Object = new Object();
combo_cb.addEventListener("change", myListener);

myListener.change = function(evt){
trace("selected item: " +combo_cb.selectedItem.data)

}
The Waiter is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

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 Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Changing the selected item in a combobox mcmcom Components 3 07-28-2006 11:42 AM
variable loading from variable makeyourself ActionScript 2.0 3 03-04-2005 09:57 PM
Watcher and variable update pinkaboo ActionScript 1.0 (and below) 3 06-26-2003 11:01 PM
Variable musings retrotron ActionScript 1.0 (and below) 8 06-24-2003 10:33 PM
strange variable behavior flashdudette ActionScript 1.0 (and below) 3 05-09-2003 06:49 PM


All times are GMT. The time now is 02:58 AM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.