Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    Flash




Populate Array From Combobox Items



Hi, I'm currently working on a project where I have a user defined list of urls which is saved in a local SO. When the movie is loaded the ComboBox is populated with the values from the SO (Stored as array inside SO). I want to give users the option to remove items from this list. So far I have managed to remove the selected item from the combo box, clear out the SO and loop the remaining ComboBox items, but, when I try and load these item into an array to parse back to the SO, the array is created and creates the correct amount of elements, but, each element is populated with only the data from the 0 index item of the ComboBox. Anyone got any ideas? My code so far: (This sits inside a button component and is invoked onClick) _root.ComboBox.removeItemAt(_root.ComboBox.selecte dIndex); _root.ComboBox.selectedIndex = 0; _root.local_data.clear(); var dataArray = new Array(); newFeed = new Object(); for (var i=0; i<_root.ComboBox.length; i++) { newFeed.site = _root.ComboBox.getItemAt(i).data; newFeed.siteurl = _root.ComboBox.getItemAt(i).label; dataArray.push(newFeed); } _root.local_data.data.myList = dataArray; _root.local_data.flush(); Thanks in advance



KirupaForum > Flash > ActionScript 1.0/2.0
Posted on: 09-14-2006, 10:02 AM


View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread

Populate Array From ComboBox
Hi,

I'm currently working on a project where I have a user defined list of urls which is saved in a local SO. When the movie is loaded the ComboBox is populated with the values from the SO (Stored as array inside SO).

I want to give users the option to remove items from this list. So far I have managed to remove the selected item from the combo box, clear out the SO and loop the remaining ComboBox items, but, when I try and load these item into an array to parse back to the SO, the array is created and creates the correct amount of elements, but, each element is populated with only the data from the 0 index item of the ComboBox. Anyone got any ideas? :? :? :?

My code so far: (This sits inside a button component and is invoked onClick)

_root.ComboBox.removeItemAt(_root.ComboBox.selectedIndex);
_root.ComboBox.selectedIndex = 0;


_root.local_data.clear();

var dataArray = new Array();
newFeed = new Object();

for (var i=0; i<_root.ComboBox.length; i++) {

newFeed.site = _root.ComboBox.getItemAt(i).data;
newFeed.siteurl = _root.ComboBox.getItemAt(i).label;

dataArray.push(newFeed);

}

_root.local_data.data.myList = dataArray;
_root.local_data.flush();

Thanks in advance.

How To Populate A ComboBox?
OK, so i need to populate a comboBox component with an XML file. Here is how my XML reads-

<?xml version="1.0"?>
<cellPhoneText>
<downLoadRingToneText>TEXT HERE</downLoadRingToneText>
<ringtoneText>RINGTONE</ringtoneText>
<youHaveSelectedText>YOU HAVE SELECTED:</youHaveSelectedText>
<previewText>PREVIEW</previewText>

<selectYourWirelessCarrierText>
<company companyName="Company"></company>
<company companyName="Company"></company>
<company companyName="Company"></company>
<company companyName="Company"></company>
<company companyName="Company"></company>
</selectYourWirelessCarrierText>
</cellPhoneText>

Here is how my Actionscript reads-

getXML("cellphone.xml", "xmlData", nextStep);
function nextStep() {
gotoAndPlay("2");
}

//////// This is the code on frame 2 that I need to edit

downLoadRingToneText_mc.txt.autoSize = "left";
downLoadRingToneText_mc.txt.wordWrap = false;
downLoadRingToneText_mc.txt.text = xmlData.cellPhoneText.downLoadRingToneText._value;

ringtoneText_mc.txt.autoSize = "left";
ringtoneText_mc.txt.wordWrap = false;
ringtoneText_mc.txt.text = xmlData.cellPhoneText.ringtoneText._value;

youHaveSelectedText_mc.txt.autoSize = "left";
youHaveSelectedText_mc.txt.wordWrap = false;
youHaveSelectedText_mc.txt.text = xmlData.cellPhoneText.youHaveSelectedText._value;

preview_mc.previewText_mc.txt.autoSize = "left";
preview_mc.previewText_mc.txt.wordWrap = false;
preview_mc.previewText_mc.txt.text = xmlData.cellPhoneText.previewText._value;


//selectCarrier_cb.autoSize = "left";
//.wordWrap = false;
selectCarrier_cb.list = xmlData.cellPhoneText.selectYourWirelessCarrierTex t._value;
//selectCarrier_cb.selectWirelessArrow_mc._x = selectCarrier_mc.selectYourWirelessCarrierText_mc. _width+2;

OK, the comboBox name is "selectCarrier_cb". How do I populate it with the <selectYourWirelessCarrierText> node?

[CS3] Populate Combobox With XML
How can I populate this XML in a combobox using AS2?

<shop> as label and <email> as data.



Code:
<document>
<item>
<shop>Shop 1</shop>
<email>Email 1</email>
</item>
<item>
<shop>Shop 2</shop>
<email>Email 2</email>
</item>
</document>

Populate A Combobox
Hello,

I am trying to figure out how to populate a combobox from a text file. Can anyone help me. I have seen the tut in kirupa but it is not clear enough for me.

Can someone help me?

Thank you

Barzalou

Populate Combobox
Is there a way to load an external txt file into a combo box.

Populate Combobox From SQL W/ ASP
I need help populating a combo box in flash MX from a SQL server 2K DB using ASP. Does anyone have an actionscript and asp page to do this? Any help would be greatly appreciated!

How Do I Populate Dynamically The Items In A Flash Menu From A Database Using Java?
Hi everybody!

Well, my question is quite straight forward. The problem is that the solution is complicated....i think.

PROBLEM: I want to dynamically populate a flash menu, where the menu items are stored in a database.I know that PHP can communicate with flash. But is there a way/implementation using JAVA/JavaScript?

Thank you guys.

Populate ComboBox From Database?
On my website, I want to have a Flash ComboBox menu of countries, and when a country from the menu is selected, the browser (GetURL) goes to a specified page.

I have an Access database that lists the countries. Using ASP, how do I populate the Flash ComboBox menu from that database? I want to pull out the list of country names from the database and have them appear in the ComboBox menu.

How do I do that? (I have no clue and I haven't been able to find a tutorial on it.)

Some background info: The site can run ASP and Access. I am using the ComboBox UI component in MX.

Any help you can offer is greatly appreciated! Thanks!!

[as3] Populate A Combobox From External Xml?
Howdy
What I have atm is a combobox with types of products in it. Thanks to arsenik I've finally gotten to the next frame (whoo). My question now is, how do I populate a new combobox using the product names from an external xml file?
I've already loaded the xml file so I don't need that code.
What I want is for the names of the products in the label and the child number in the data field (product.type.name[n] - I want n in the data field).

Has been driving me mad for nearly two days! (have been working on this while trying to get the previous frame to work right as well)

Populate Both Data And Labels Into ComboBox
How can I tell the comboBox through ActionScript what its Data is (i.e., 0,1,2,3,...) and to function based on that and still load Labels in though Script also? (All examples I've found function on the Label.)

I have created a slide show that uses a Flash MX comboBox as a jump menu. It also has next and previous buttons to advance one slide at a time. It works fine if I load the Labels and Data in the Properties Inspector.

I can successfully populate the comboBox using ActionScript with Labels, but I want to add the ActionScript so it will function based on Data 0,1,2,3,4,... (rather than function based on the Label title).


Here's my code:

slideTitles = "Slide 1|Slide 2|Slide 3";
theSlideTitles = slideTitles.split("|");

//Populate Combo Box
for (i=0; i<theSlideTitles.length; i++) {
comboBox.addItemAt(i, theSlideTitles[i], theSlideTitles[i]);
}

// Sort the List
comboBox.sortItemsBy("Label", "ASC");

NEED HELP ON CODE AROUND HERE.

function jump() {
theItem = comboBox.getSelectedIndex();
theValue = comboBox.getValue(theItem);
if (theValue == 0) {
gotoAndStop("L1");
slideNumber = "Slide "+1;
loadMovie("movie.swf", 1);


Thanks for any help.

SeeMore

Populate Flash2004Pro ComboBox With XML String
Hi,

I have a combobox, and an XML string (which comes from a web service):

code:
<countries><country label="Andorra" data="37" /><country label="Austria " data="38" /><country label="Belgium" data="39" /><country label="Bulgaria" data="40" /><country label="Croatia" data="41" /><country label="Cyprus" data="42" /><country label="Czech Republic" data="43" /><countries>

.... etc

I want to bind the combobox to the XML string. How do I go about this. I know that I can iterate through the XML nodes and use the addItem method, but I believe that this is slower than binding to a dataset.

Any help appreciated.
GW

Populate Combobox With Titles And Url Links
Hi all - okay I'm trying to populate a combobox with links and urls from an xml file. I've got the xml data no worries, but I'm having fun getting it into the combo box.

I want the box to show the title and to follow the link when selected. Any help please! Preferrably in code form as I've looked over several tuts on this site and others to no avail.

I'm using 04pro.

thanks

frank

Populate ComboBox Inside AttachedMovie?
I can NOT seem to target my comboBoxes that are inside a movieClip that is being attached to the stage from the library.

Is this a known bug or issue?..I can populate my comboBox anywhere else..even nested inside other movieClips (created at authoring time)..

Is there a way to "pause" your code..after I attach the clips to the stage..and before I loop through my XML to populate the combo boxes??

the reason I ask..is I have been searching & searching...and I stumbled upon a thread that stated he thought the combo boxes were created/initialized fast enough to be populated.... possible scenario??

can anyone else sucessfully populate a comboBox (externally)inside of a clip you attach to the stage from the library?

Thanks..

How To Populate A ComboBox Properly With Flash Remoting
Hi

Got a question about ComboBox, I am populating a ComboBox with Flash Remoting. Currently I want to pull a Name column from a database. Right now I am populating a dataset. The ComboBox pulls from the dataset. However the Combobox displays the Name column plus two other columns.

How can I send out from the dataset just the Name Column to the ComboBox?

I include some code if it helps.
Thank you


Code:
#include "NetServices.as"
var frGatewayURL = "http://localhost/flashremoting/gateway.aspx";
var frServiceName = "test";

this.onLoad = function() {
NetServices.setDefaultGatewayUrl(frGatewayURL);
var frConnection = NetServices.createGatewayConnection();
var frService = frConnection.getService(frServiceName, this);

frService.getProjects();
}
function getProjects_Result(result) {
//projects is a dataset
projects.dataProvider = result;
}

function getProjects_Status(error) {
trace("-------- Remoting Error ---------");
this.type_txt = error.type;
this.desc_txt = error.type;
trace(error.type);
trace(error.description);
trace("---------------------------------");
}

How To Populate A ComboBox Properly With Flash Remoting
Hi

Got a question about ComboBox, I am populating a ComboBox with Flash Remoting. Currently I want to pull a Name column from a database. Right now I am populating a dataset. The ComboBox pulls from the dataset. However the Combobox displays the Name column plus two other columns.

How can I send out from the dataset just the Name Column to the ComboBox?

I include some code if it helps.
Thank you


Code:
#include "NetServices.as"
var frGatewayURL = "http://localhost/flashremoting/gateway.aspx";
var frServiceName = "test";

this.onLoad = function() {
NetServices.setDefaultGatewayUrl(frGatewayURL);
var frConnection = NetServices.createGatewayConnection();
var frService = frConnection.getService(frServiceName, this);

frService.getProjects();
}
function getProjects_Result(result) {
//projects is a dataset
projects.dataProvider = result;
}

function getProjects_Status(error) {
trace("-------- Remoting Error ---------");
this.type_txt = error.type;
this.desc_txt = error.type;
trace(error.type);
trace(error.description);
trace("---------------------------------");
}

[F8] Is It Possible To Populate An Array With...
...file names from a local folder?

I know this is possible using php, but I was wondering if it could be accomplished using flash alone and if anybody had any ideas how to do it.

Thanks in advance.

Populate An Array Values From An Array
ok i have this xml file

Code:
<artworkinfo>
<movieinfo>
<artLocation>cover1.jpg</artLocation>
<movie>Live Free or Die Hard</movie>
<plot>John McClane takes on </plot>
</movieinfo>

<movieinfo>
<artLocation>cover2.jpg</artLocation>
<movie>Meet the Robinsons</movie>
<plot>Lewis is a brilliant inventor </plot>
</movieinfo>

</artworkinfo>
the xml will tell where the cover art is the movie title and plot.
i want to populate my movie with this info what is the best approach to create empty movieclips using actionscript or create individuals MC , i try the second one and create 4 movieclips (cause the xml have 4 elements just post 2) and make an array of mc but i can find how to match the xml array to the mc array , this is the code for better explaining,


Code:
function loadXML(loaded) {

if (loaded) {

xmlNode = this.firstChild;
image = [];
movie = [];
plot = [];
total = xmlNode.childNodes.length;
for (i=0; i<total; i++) {

image[i] = xmlNode.childNodes[i].childNodes[0].firstChild.nodeValue;
movie[i] = xmlNode.childNodes[i].childNodes[1].firstChild.nodeValue;
plot[i] = xmlNode.childNodes[i].childNodes[2].firstChild.nodeValue;

}
placeholder=new Array(loader1,loader2,loader3,loader4);
placeholder_total = placeholder.length;
for (e=0; e<placeholder_total; e++){
placeholder[e].contentPath=this.image[i];
}


} else {

content = "file not loaded!";

}

}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("movieinfo.xml");
the stage have 4 movieclips name loader1,loader2,ect... each mc have 2 dynamic text field one for title and one for the plot.

Populate Dataset From Array
Hi,

I have a 2 dimensional array which I want to use as a data source for a datagrid.

The array is something like this:

source = new Array(new Array("COL1-ROW1","COL2-RO"1","COL3-ROW1"), new Array("COL1-ROW2","COL2-ROW2","COL3-ROW2"), new Array("COL1-ROW3","COL2-ROW3","COL3-ROW3"));

How do I map this to my datagrid?

Thanks in advance.
GW

Using A For Loop To Populate An Array
Really trying to get my head around this but still need help... please.

What I am trying to achieve is to populate 8 instances of orange_mc, 6 instances of pear_mc etc. etc. and drag and drop them over different target area. I am thinking that the trace should give me the following: orange_mc1, orange_mc2, orange_mc3 etc. Neither this nor the drag is working. What am I missing? Want to repeat this for all items in the array.

code:
var fruit:Array = new Array();

fruit[0] = "orange_mc";
fruit[1] = "pear_mc";
fruit[2] = "apple_mc";
fruit[3] = "banana_mc";
fruit[4] = "kiwi_mc";

var newOrange
for (var i=0; i<8; i++){
newOrange[i] = newOrange["orange_mc", + i];
trace(newOrange);

_root.newOrange.onPress=function() {
this.startDrag();
}
}

Populate Array From A Database?
can anyone help me figure out how to populate an array based on a flash search sent to ASP and from ASP to a MS Access database... like a set of instructions..

ex. you search for step 2 to 5. flash sends the variables 2 and 5 to the ASP, asp searches in the database for the steps, the steps return (2,3,4,5) to asp and somehow display some instructions to flash to execute the array in that order.

i might be totally off by the logical flow, could someone help me out? thanks!

[F8] Can't Populate Array - Undefined
Hello,

I've been trying to make a word scramble function that selects a random strings from "wordArray", removes spaces, scrambles the text, and repopulates that scrambled text in to "scrambledArray".

But for whatever reason, the scrambledArray comes up undefined when I trace it.

What am I doing wrong? I've checked and rechecked my code but can't figure this out at all! Starting to lose my mind over this. I've been at it for the past 6 hours

This is the exact code i'm using:


PHP Code:



var wordArray:Array = new Array("Words with spaces", "Different words", "single", "more words with spaces", "another string with spaces");
var scrambledArray:Array;
var tempString2:Array;
var tempString3:Array;
//
function scrambleWord():Void{
    //select random string from array
    n = Math.floor(Math.random()*wordArray.length);
    tempString = wordArray[n];
    trace("word: "+tempString);
    //remove spaces
    tempString2 = tempString.split(" ").join("");
    tempString3 = tempString2.split("");
    //scramble words
    duration = tempString3.length;
    for(i=0; i<duration; i++){
        r = Math.floor(Math.random()*tempString3.length);
        t = tempString3.splice(r,1);
        trace("t: "+t);
        scrambledArray.push(t);
    }
    trace("scrambledArray: "+scrambledArray)
}

scrambleWord();




Can someone please shed some light on this? Pretty please?

P.S. using flash 8

Populate An Array With Push()
Hi
I'm having problems populating an array inside a loop, here's my code:


ActionScript Code:
pic_arr = new Array();

    for ($i=0; i<=5; i++) {
       
        pic_arr.push(eval("this.pic" add i));
};

do you know what's wrong?

ratamaster

Populate A Datagrid From An Internal Array
Hi. Is it possible to populate the datagrid from an internal array, rather than an external xml file?

M@)

Populate Array In Attached Clip.
ok.. I have soem code that read my XML file....then attaches clips based on how many NODES there are...

then I populate each of these attachedClips with data from child nodes..etc.. like name, price..etc this all works fine..as the data is displayed in textFields right away.

my problem is I am trying to create & populate an array in the attachedClip when it is created.

Im an not sure what I am doing wrong...but the array seems to ONLY be getting the LAST value I .push into the array.

Can anyone tell me what I am doing wrong..and why i cant populate the Array Im making in the attachedClip?

code Im using the populate the clips:

Code:
//populate
function populateAll():Void {
for (i = 0; i < totalProducts; i++) {
var totalSizes:String =productsNode[i].childNodes[3].childNodes.length;
var totalQuantity:Number =productsNode[i].childNodes[7].childNodes.length;

//colors
var colorLength:Number =productsNode[i].childNodes[4].childNodes.length;
trace("Total Colors: "+colorLength);
for (z = 0; z < colorLength; z++) {
var totalColors:Array =productsNode[i].childNodes[4].childNodes[z].firstChild.nodeValue;
var obj = this["product" + i];
obj.colorChoices = new Array;
obj.colorChoices.push(totalColors);
trace("Array Index"+[z]+": "+obj.colorChoices);
//trace("Product"+i+": "+totalColors);
//trace(totalColors + "=yes");
//trace("Product"+i+": "+obj.totalColors);
//trace("Product"+i+": "+obj.colorChoices);
}

trace(newline);

}
}


then INSIDE the attachedClips there is a movieClip that acts a a button, 9wher I try tracing my array..but ONLY the last value displays!!!


Code:
this.onPress = function() {
_root.selectedName_txt.text = _parent.name_txt.text;
_root.selectedPrice_txt.text = _parent.selectedPrice;
trace(_parent.colorChoices); //array I try to populate
}


like its NOT treating it as an ARRAY..but just a VAR (with 1 value)

[F8] Numeric Steppers To Populate Array
Hi. I have this array with values from 1 to 20. I am wanting to use to numeric steppers to populate the array or a different array depending on what values are chosen by the steppers. Stepper on is from 1 to 20 and stepper 2 is from 2 to 20.
code:
var myArray:Array = ["A","B","C","D","E","F","G","H","I" etc...up to 20 elements]

//so if they had chose 2 on the first stepper and 5 on the second stepper.
//The array would contain the values B through E
//Then when they make another choice the array would clear itself and do what //They chose say 4 on first stepper and 7 on second
//The array would now contain D through G etc
//Everytime they choose different number on stepper the array clears itself
//then populates with new values. There are 20 possible values in array


I think myArray above would be used to get the elements of a the new array.
Hope that makes sense.

Thanks
JamesLoacher

Populate Dynamic Textbox With Value From Array
Hello,
I am trying to populate a dynamic text field with the output value of an array I bulit that randomly chooses a number. Sounds easy, but I keep getting "undefined" in my dynamic text box. Here is the code below... the line in red is the textbox I am trying to get the value from the array to show up in the dynamic textbox. Not sure if the value "oponent" is what needs to be there or something else. Thanks for your help.

Mike



//rating vaules for player and oponent

var cr= 3.36;
var best= "5.0";
var better= "4.0";
var worse= "3.5";
var worst= "3.0";

//game start initial ratings
_root.game.scoreboard.currentRating.value=cr;
_root.game.scoreboard.oponentRating.value=oponent;


//array for randomly choosen opponent level
oponent= [best, better, worse, worst];
submit_btn.onRelease = function() {
ranNum = Math.floor(Math.random()*oponent.length);
trace(oponent[ranNum]);
};

Populate Dynamic Text Box With Value From Array
Hello,
I am trying to populate a dynamic text field with the output value of an array I bulit that randomly chooses a number. Sounds easy, but I keep getting "undefined" in my dynamic text box. Here is the code below... the line in red is the textbox I am trying to get the value from the array to show up in the dynamic textbox. Not sure if the value "oponent" is what needs to be there or something else. When I just have "oponent" there, it prints out every value in my Array (5.0,4.0, 3.5,3.0) as text. I just wanted the one randomly selected number that I see in my ouput screen when I test the movie.

Thanks for your help.

Mike



//rating values for player and oponent
var cr= 3.36;
var best= "5.0";
var better= "4.0";
var worse= "3.5";
var worst= "3.0";


//array for randomly choosen opponent level
oponent = new Array (best,better,worse,worst);





submit_btn.onRelease = function() {
ranNum = Math.floor(Math.random()*oponent.length);
trace(oponent[ranNum]);


};


//game start initial ratings
_root.game.scoreboard.currentRating.value=cr;
_root.game.scoreboard.oponentRating.value =oponent.ranNum.value;

Populate Array With Object Not Work
Why cant I put an object into an array then find its properties like
trace(aLevel2[0].lab); //undefined



Code:
var ref = "second"+k;
var ref:Object = new Object();
ref.childOf = i;
ref.lab = X.firstChild.childNodes[i].childNodes[k].attributes.label;aLevel2.push(ref);

Dynamically Populate Associative Array
I am trying to create an associative array and dynamically populate it with information from an XML file. I have no idea how to make a loop that can achieve this, all my attempts thus far have failed. Here is an example of what I need the array to look like.


ActionScript Code:
var selectionData:Array = [
    { title:"Thumb 1", thumb:"../images/thumbs/thumb_01.jpg", lowres:"../images/lowres/lowres_01.png", hires:"../images/hires/hires_01.jpg" },
    { title:"Thumb 2", thumb:"../images/thumbs/thumb_02.jpg", lowres:"../images/lowres/lowres_02.png", hires:"../images/hires/hires_02.jpg" },
    { title:"Thumb 3", thumb:"../images/thumbs/thumb_03.jpg", lowres:"../images/lowres/lowres_03.png", hires:"../images/hires/hires_03.jpg" },
    { title:"Thumb 4", thumb:"../images/thumbs/thumb_04.jpg", lowres:"../images/lowres/lowres_04.png", hires:"../images/hires/hires_04.jpg" },
    { title:"Thumb 5", thumb:"../images/thumbs/thumb_05.jpg", lowres:"../images/lowres/lowres_05.png", hires:"../images/hires/hires_05.jpg" },
    { title:"Thumb 6", thumb:"../images/thumbs/thumb_06.jpg", lowres:"../images/lowres/lowres_06.png", hires:"../images/hires/hires_06.jpg" }
];

Here is what my code looks like to populate a normal array.


ActionScript Code:
var image:Array = new Array();
var rootNode:XMLNode;
var total:Number;
var xmlData:XML = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("data/images.xml");

function loadXML(loaded) {
    if (loaded) {
        rootNode = this.firstChild;
        total = rootNode.childNodes.length;
        for (var i:Number = 0; i < total; i++) {
            image[i] = rootNode.childNodes[i].nodeValue;
        }
    } else {
        trace("Ahhhhhhh crap!");
    }
}

Populate Class That Extends Array?
Hi!

Ok, I want a class that extends an array, and populates itself with named key values. Like this:

var array:CustomArray = new CustomArray();
trace(array['a']); // Outputs 'Hello World!'

But, writing this['a'] = 'Hello World!' inside the CustomArray class does not work, obviously.

I'm sure I can think of a workaround, but let's just say I want it like this, how do I do it? How do I create the 'a' key inside the CustomArray class and assign a value to it?

/ Frank

Clear Items In Combobox
Hi I have a combobox and am populating it from an asp script when a user clicks a button on the form.
However if the user clicks the same button again, it just adds the same information to the combobox and does not clear it and then load the new data. Is there a way of having it clear the combobox and then load in the new data, so as to stop the repeating of data?

here is the code:
This code below exists in a frame which is in the Load Actions Layer
---------------------------
myData = new LoadVars();
myData.onLoad = AddItems;
function myFunctionDropDown() {
myData.load("DDValues.asp")
}
---------------------------

This code below exists in a frame which is in the Load Actions Layer
---------------------------
function AddItems() {
NumItems (it's in the myData object).
numItems = myData.NumItems;

for (i=0; i<numItems; i++) {

var Name = eval("myData.Name"+i);
var Value = eval("myData.Value"+i);
var Value2 = eval("myData.Value2"+i);

var DataProvider = { Value:Value, Value2:Value2};
dropDown.addItem(Name, DataProvider);
}

dropDown.setChangeHandler("SelectItem");
}

function SelectItem(){
_root.Value= dropDown.getSelectedItem().data["Value"];
_root.Value2= dropDown.getSelectedItem().data["Value2"];
}
---------------------------


Many Thanks in advance,

Can't Add Items To A Combobox Dynamically
Hey Guys, I can't seem to load the following array into the comboBox. I dragged the Box onto the stage and I named it Cbox_cb. All I get in an "undefined" in the combo box when I run the movie.

school_array = ["BCM Korea", "Korea ", "Auckland", "Christchurch", "Wellington", "Brisbane", "Goldcoast", "Cairns", "Sydney", "Melbourne", "Perth", "Vancouver", "Victoria", "Toronto", "Calgary", "Montreal", "Ottawa", "New York", "Boston", "Costa Mesa", "Honolulu", "San Francisco", "Cebu", "Brighton & Hove", "Eastbourne", "London", "Dublin", "Malta", "Granada", "Marbella", "Costa Rica", "Singapore", "Tokyo", "Cape Town", "Paris", "Bangkok", "Xian"];

function buildNav() {
comboText_array = new Array();
var len = school_array.length;
for (i=0; i<len; i++) {
var location = school_array[i];
comboText_array.push(location);
Cbox_cb.addItem(location);
}
Cbox_cb.setChangeHandler("loadClip");
}
buildNav();

Any Help would be appreciated.

THanks

ComboBox And Multiline Items
hi,
how can I set the textfoeld items in the comboBox to multline and wordWrap?

I've tried something like:

Code:
cb.getChildAt(1).getChildAt(0).multiline =true;
cb.getChildAt(1).getChildAt(0).wordWrap =true;


or:

Code:
cb.setStyle("wordWrap",true);
cb.setStyle("multiline",true);


or:

Code:
cb.dropdown.setStyle("wordWrap",true);
cb.dropdown.setStyle("multiline",true);


but none of thos simple ways brought me luck. Should i work with the CellRendere class to do this?

thanks,

Jerryj.

Multiline Items In Combobox
hi,
how can I set the items in the comboBox to multline and wordWrap?

I've tried something like:

Code:
cb.getChildAt(1).getChildAt(0).multiline =true;
cb.getChildAt(1).getChildAt(0).wordWrap =true;
or:

Code:
cb.setStyle("wordWrap",true);
cb.setStyle("multiline",true);
or:

Code:
cb.dropdown.setStyle("wordWrap",true);
cb.dropdown.setStyle("multiline",true);
but none of thos simple ways brought me luck. Should i work with the CellRendere class to do this?

thanks,

Jerryj.

ComboBox Items Limit
Hi there!

It seems ComboBoxes have a limit of the number of Items they are able to store...
(around 200)
Does somebody have any information on this subject ?

Thanks in advance for your replies.

Hyperlinks To Items In ComboBox
I'd like to assign a hyperlink to the items in the combobox.
Can anyone please explain me how to do it?

Hyperlinks To Items In ComboBox
I'd like to assign a hyperlink to the items in the combobox.
Can anyone please explain me how to do it?

Populate Dynamic Text Field With PHP Array
I would like to be able to dynamically populate a dynamic text field (assuming that's the best component to use) with an array of data from PHP.

I have attached my PHP code and my Flash Code.

The PHP code is working fine and generating the array.

The first part of the AS code is working as I can see the pop-up window with the PHP array in it. However, I can't figure out how to get the array to display in the dynamic text box.

I have created a dynamic text box in flash with nothing in the 'instance name' box and 'events' in the var box.

What am I missing? Any help would be greatly appreciated!!!









Attach Code

PHP CODE:

$eventsQuery = "SELECT * FROM events_tb ORDER BY eventID DESC LIMIT 5";
$eventsResult = mysql_query($eventsQuery);
$i= 0;


while ($eventsRow = mysql_fetch_array($eventsResult))
{
echo "event$i=<a href='content.php?fcn=events&pieceid=".$eventsRow['eventID']."'>".$eventsRow['eventName']."</a>,";
$i++;
}

AS CODE:

myData = new LoadVars()
myData.ref = this
myData.load("flIndexEvents.php")
getURL("flIndexEvents.php", "_new")
myData.onLoad = function(succes){
if(succes){
for(var i=0; i<this.events; i++){
this.ref["events"+i].text = this["events"+i]
}
} else trace("Error loading data")
}

How To Add Two Items To ComboBox Data Field
I'm using the comboBox component in Flash MX. I build an array of the contents which consists of a label, units and value and use mcComboBox.setDataProvider(_root.comboArray) to fill the box. When a user selects an item it is added to a list so it is also removed from the comboBox via mcComboBox.removeItemAt(mcComboBox.getSelectedInde x());

The problem is a user can delete an item from the list, meaning I need to add it back into the comboBox. Using a new Object myItem to build the item to add the label, units and value I can only get the label back into the comboBox, How do I set the comboBox data to be the units and value?

Any suggestions would be appreciated. After re-reading this I don't think I stated my problem very clearly, but let's let the questions fly, ok?


relevant Code:
<pre>
arrayNonpest = new Array();
arrayNonpest = [
[ "--Select an item--","",0],
[ "26GT®","(2 x 2.5 gal/case)",450],
[ "Acclaim® Extra","(4 x 1 gal/case)",1350]
]

comboArray = new Array();
for (i = 0; i < arrayNonpest.length; i++) {
// create a real item
var myItem = new Object();
myItem.label = arrayNonpest[i][0];
myItem.unit = arrayNonpest[i][1];
myItem.value = arrayNonpest[i][2];
// put it in the array
comboArray[i] = myItem;
}
mcComboBox.onLoad = function() {
mcComboBox.setDataProvider(_root.comboArray);
};
.
.
.
//checkBox changeHandler:
function checkHandler(component) {
a = component._name;//actually this is the position number
var myItem = new Object();
myItem.label = eval("mcItem" + a).itemName.text;
myItem.unit = eval("mcItem" + a).itemUnit.text;
myItem.value = eval("mcItem" + a).itemValue.text;
mcComboBox.addItem(myItem.label);
//mcComboBox.sortItemsBy("label","ASC");
}
</pre>

Combobox: Get Number Of Total Items
hi there,

i need how to get the total number of items in a combobox. already tried it with
Code:
combobox.length;
but it doesn't work.

i use MX prof. 2004, but need it to work for FP 6, AS 1.

anybody got an idea?

cu
eve

Question On Accessing Combobox Items Through Xml
sir

i got an error while changing the combobox item i.e i have wriiten a program to retrive the data from an xml file and display the corresponding image file using loadMovie command. i also written a "change" function for the combobox. when i click the first item i didn't get any image in the loader but for the second item i got it. so is there any problem in accessing the selected Index value of the combox?.

Thank you.

Changing Items In A Combobox After Selected
Greetings all,
i have a quick question that i'm pretty certain is possible, i'm just not certain of the exact code as to how to do it...

i have a combobox (actually 2, but if i can get it to work for one, i'm certain i can get it to work for both), where i have the default line "Affiliates" at the top so it is what appears to the user. Then below I have a list of 3 affiliates.
What I was wanting to do was to have "Affiliates" listed initially, but when the user clicks the combo, I didn't want it to actually appear in the list...
how would i go about this?
at worst, i want it to not appear after the user selected an affiliate from the list for the first time...

TIA.

ComboBox Items List Invisible
I've put on the library a combobox so i can call it at runtime.
That combo is created inside a movieclip (for effects and so on) and items
are added at runtime.
I have the problem that the combo show only the selected item and if i try
to browse it's content nothing happends...it doesn't open.
The strange behaviour is that if i click where i suppose to be an item, that
item become the active item.

Added a simply portion of code to show that, so you can help me.

_root.createEmptyMovieClip("mcHolder", _root.getNextHighestDepth());

with (mcHolder) {
beginFill(0xFF00FF, 100);
moveTo(0, 0);
lineTo(200, 0);
lineTo(200, 200);
lineTo(0, 200);
endFill();
_x = 100;
_y = 100;
}

mcHolder.createObject("ComboBox", "ccbTest", _root.getNextHighestDepth());

for (var i:Number = 0; i<10; i++) {
mcHolder.ccbTest.addItem("val"+i, i);
}

How to solve the problem?

Regards

ComboBox Items List Invisible
I've put on the library a combobox so i can call it at runtime.
That combo is created inside a movieclip (for effects and so on) and items
are added at runtime.
I have the problem that the combo show only the selected item and if i try
to browse it's content nothing happends...it doesn't open.
The strange behaviour is that if i click where i suppose to be an item, that
item become the active item.

Added a simply portion of code to show that, so you can help me.

_root.createEmptyMovieClip("mcHolder", _root.getNextHighestDepth());

with (mcHolder) {
beginFill(0xFF00FF, 100);
moveTo(0, 0);
lineTo(200, 0);
lineTo(200, 200);
lineTo(0, 200);
endFill();
_x = 100;
_y = 100;
}

mcHolder.createObject("ComboBox", "ccbTest", _root.getNextHighestDepth());

for (var i:Number = 0; i<10; i++) {
mcHolder.ccbTest.addItem("val"+i, i);
}

Regards

Hyperlinks (URLs) To Items In ComboBox
I'd like to assign a hyperlink (URL) to the items in the combobox.
Can anyone please explain me how to do it?

Combobox With Deactivated Items [Categories]?
hey guys, is it possible to make it so that certain items in a dropdown have deactivated items because i want to have categories like:

Main
Option1
Option2
Blah
Option3
Option4

is it possible for Main, Blah to also have different font color?

Hyperlinks (URLs) To Items In ComboBox
I'd like to assign a hyperlink (URL) to the items in the combobox.
Can anyone please explain me how to do it?

Load XML And Populate Array Before Preload Finishes - Not Working
During the preload of a file I want the XML to be loaded and various elements put into an array before moving on.

I have my standard preload code with additional checks to see if _global.XMLloaded and _global.ARRAYloaded are set to true before ending preload.

I start by initialising both of these to false.

I then stop(); and have my XML start loading and reading into the array.

In the my_xml.onLoad function I check to see it's the last xml file being loaded and if so set _global.XMLloaded to true at the end of the function.

In the function that's outputting the data into the array I have:

for (var i=0; i<pages.length; i++) {

//Code to output to array here

if( i == pages.length - 1)){
trace("ArrayLoaded");
_global.ARRAYloaded = true;
}

}


I hope this paints some kind of picture of what I'm trying to do. Basically it's not working and the traces are coming out but the swf is carrying on past the preloader before the entire array is loaded. I don't know much about asynchonicity so maybe it's something to do with this?

Any advice on this or how I can get round this?

Populate Array In Flash With The Contents Of A Directory(folder)
Hi all,

I'm trying to get Flash MX 2004 to read the contents of a specified directory (containing .jpg files) and populate an array that I can then read from the array to view the images within the flash movie.

I want to be able to add more images to the directory without having to edit hard coding of the array everytime. Plus I don't want to have to name all the images "image0.jpg, image1.jpg, image2.jpg" etc...

Can anyone help???

Many Thanks


Craig

Copyright © 2005-08 www.BigResource.com, All rights reserved