Actionscript 3.0 :: Binding Dropdown List Using XML?
Apr 17, 2010share a quick and easy example about how can I bind xml file into dropdown list
View 1 Repliesshare a quick and easy example about how can I bind xml file into dropdown list
View 1 RepliesI have a bit of a problem (since I'm not used to binding with AS3), the thing is that I want to do this kind of data binding:
<mx:Application xmlns:mx="[URL]"
layout="vertical"
verticalAlign="middle"
backgroundColor="white">
[Code] .....
But the ComboBoxes are being created dynamically with AS3, everything is working except I cant bind the second ComboBox dataProvider to be the XMLList in the first ComboBox's selectedItem.
We are rewriting our multiscreen game from Flex Project to ActionScript Mobile Project (root object is flash.display.Sprite and not spark.components.Application). Aim is to increase performance on tablets and have better overview what exactly is going on, what listeners are added and so. (I just don't trust Flex in this.). Do you know any alternative for DropDownList and/or DataGrid? I can't use MinimalComps, because there are little options to customize.
View 2 RepliesHere is piece of code:
protected function handleTriggers(raw:Object) : void {
var name:String, value:String, map:Object;
map = {
'onclick': MouseEvent.CLICK,
'ondblclick': MouseEvent.DOUBLE_CLICK,
[Code] .....
Object is generic DisplayObject and raw object contains series of onclick, onmouseover, etc event triggers. It was meant that I could attach event listeners automatically following the properties of that raw object. And it seems like it works, as I indeed can see some listener Functions in listeners property of the DisplayObject and their number corresponds to the number of triggers. But later when everything is put on stage, only the last event handler gets triggered.
I am building a flash banner ad that contains a dropdown list of US states. Once the list is clicked I want to pass the state code onto the end of the url for the ad.I used to be ok with actionscript but it was several years ago, and I'm wondering if its possible to have the ad grab the URL from the parent <a href> and just tack the state code onto it.I assume this is how clickTags work?[code]Can anyone offer any tips on how best to do this? I'm fine with building the actual ad, its just I'm not sure if I need to hard code 50 urls into my dropdown? It seems a bad way of doing things, and I'm sure theres a better way?
View 1 RepliesIt's possible to do this html effect (the drop-down list) in flash
Code:
html code example
<SELECT NAME="cities">
<OPTION VALUE="paris">Paris</OPTION>
<OPTION VALUE="francisco">San Francisco</OPTION>
<OPTION VALUE="jose">San Jose</OPTION>
<OPTION VALUE="vegas">Las Vegas</OPTION>
</SELECT>
I'd like to display tool tips, once the user holds his mouse on an item of an opened combobox.Ifyou open the drop down list of a combo box, you'll see a list ofelements/items. Each of them can be accessed e.g. viamyCombo.getItemAt(0) .To me it seems I only get an object with adata and label property. But I think there must be more to it, becausewhen you hold your mouse over a sub-element, it'll be highlighted. Thismeans that there is some event listener on that very single item. Sohow can I do this?[code]
View 3 RepliesI have a dropdownlist of "Select an employee" which is optional. I need it to have "No one" at the top so that user can change back to NoOne if he' ve already chosen "John Someone".
My question is how to keep the prompt item, or add a dummy item at -1 without changing the dataprovider (I really hate adding "No one" to the original employeeList dataprovider)
[URL]
Flex 4 Drop Down List - bound with data service, how to always keep prompt or add item at index -1 programmatically
IS there a way with flashes combo box to change the value without selecting one from the dropdown list.I tried [code]
View 7 RepliesTo show the complete list of available colors, one has to click the color box of ColorPicker control.How can the component be modified to forcefully always shown the colors list without any interaction from the user?
View 1 RepliesI seem to have is that the Autocomplete component that seems to be part of flex extras is not displaying the list of items in the dropdown list. Basically, I get a list of blank items. I know they are there and they are the right items because as soon as I click on one, I get the right text in the combobox.
my Code in the mxml looks something like this
<mx:FormItem label="Company:" width="750" fontSize="20" horizontalAlign="right" color="#000000" required="true">
<ns1:AutoComplete enabled="true" labelField="CompanyName" textAlign="left" dropdownWidth="450" id="txtCompany" width="450" />
[Code]....
Again, when I type "T" in the text box I see a dropdown list with 3 empty items. Clicking on the third item puts "Test3" in the textbox. But the items themselves are not visible.
It almost as if its a font/foreground color thing, but I've played around with some of those settings too with no success.
Is there anyway to change the colour of items showing in the dropdown list? By default, it's showing skyblue and I need to change it into grey? I'm using Flash CS4 IDE and AS3.
View 1 RepliesI want to show some different-2(dynamic) icon in my combo Box drop down list. I am able to show icon in combo box list but I want to change the color of this icon for different-2 values.
Here is ActionScript Code:
for(i=0;i<len;i++){
newColor = "0x"+_root.colorList.items[i].ColorCode;
labelText = _root.colorList.items[i].DeptCodeComboDesc;
comboClip.clip.opaqueBackground = parseInt(newColor);
_root.colorListCombo.addItem({label:labelText,pIcon:"comboClip"});
"comboClip" is a clip which I want to show as icon in combobox.
Is it possible to specify MXML-esque "binding strings" in ActionScript?For example, I want to be able to do something like:
MXMLBinding(this, "first_item",
this, "{myArrayCollection.getItemAt(0)");
MXMLBinding(this, ["nameLbl", "text"],
[code].....
I'm having with a menu navigation system. I'm using Flash MX. I have created a menu system for the site I'm building ([URL]) where one of the buttons "Choose photographer" drops down a list of names. All the other buttons just jump to another page. The drop down is currently using tweens also the logo moves to the left as the dropdown appears and returns when the dropdown returns. All working fine apart from its a bit jerky.
It's I just wanted to get away from tweening and use action scripts instead, as I'm a newbie to all things Flash I trawled the net for tutorials and examples so that I could cobble together the exact same effect. I have managed to get the drop down work and return using the action script and it does seem smoother and works slightly better. But can I get the logo to move to the left and back in time with the drop down...no.
I'm creating a webpage, and I have made some buttons.Image 1 is the homepage, which is frame 1 in Flash.Image 2 shows that when I rollover the button "Portfolio,"I get a dropdown menu.I have this set as frame 3 in Flash.Image 3 shows that I've gone down the dropdown menu and rolled over "Photography." But if I rollout of any of the things from the dropdown menu, it stays at Image 2 (Frame 3)with the dropdown menu visible. Which is a problem...I want to be able to rollout of these buttons to revert back to the homepage, Image 1 (Frame 1).But, for instance, telling "Graphic Design" to go to Frame 1 on rollout means that if I try to go below "Graphic Design" to "Photography," I've rolled out--and so the rest of the menu disappears.So I want to roll be able to select anything from the dropdown menu, and only rollout to Frame 1 if I go outside the entire dropdown menu, not just one button.
Attachments:
3.jpg
(134.5 K)
My application uses fx tag in which it loads some xml. I want to create the xml name by binding, but I get an error that Data binding expressions not supported with attributes processed at compile time.
<fx:XML id="{xml_props}" />
<fx:XML id="{xml_props}" />
I have this variable in Model class:[code]I've used BindingUtils to get notified when the XML changes:[code]Function onChange gets triggered when I assign an XML to the variable, but not when I change some attribute of the XML: Model.getInstance().someXml.@attr = "newValue";
View 1 RepliesI'm currently looking at ways to externalise all text in my flash applications into external xml files (for translation purposes). Basically, all copy in these applications has to be in two languages (English and Welsh).
At the moment, I'm just looking at a structure whereby the name of each TextField instance is the same as a field in the XML, which then has two fields (<english> & <welsh>) inside with the relevant text. The XML will be loaded in and then looped through applying the text to the textfield of the same name in the current language. There will obviously need to be some error-handling with regards making sure the names match up but this can only be done at run-time.
This seems a bit, I dunno.. lose? Is there are way of creating a better structure or system that'll be a bit less reliant on accurately naming various things so they match?
I actually got it to show up in the dynamic text box, but its also displaying my xml and css tags(The XML file structure). I know the xml and css files both work after testing them in my browser. My XML file only has one node. Below is my AS3 code:
Code:
var loader:URLLoader = new URLLoader();
loader.addEventListener(Event.COMPLETE, onLoadXML);
loader.load(new URLRequest("content.xml"));
function onLoadXML(e:Event):void {
var xml:XML = new XML(e.target.data);
//trace(xml)
textBox.text = e.target.data
}
I just need it to read the content and follow the css code that's been attached to it.
I'm using flex 4.1 to write an application. i read in the documents that has the rowCount property to set how many items to display. the does not have that property. how can I limit the list to display 3 items ?
View 3 RepliesI am working on an older Flash project created in CS3 ActionScript 2.0 How can I make the pointer cursor change to the hand when hover over a list item?_root.slidePanel.myList'myList' is the list. I have traced out the contents of the List MC and it has a child MC called 'content_mc'. I assumed this was the object containing all of my list items but the only members of this MC I can see (when tracing them out) are 'setRGB' and 'searchKey'.
View 1 RepliesFlex 3 List control had a itemRollOver event. Flex 4 List doesn't have it. Is there an equivalent or a workaround for this issue?
View 2 RepliesCreating a dynamic list and associating a picture with each list item. i need the list to be scrollable, and i want the list and it's associated picture to be displayed randomly when the application is re-launched. i.e it doesnt show the same list everytime.
I also what to be able to sort the displayed list items. e.g if the list items is about restaurants, i want users to be able to sort the displayed items by either; district, cusine type and gastro type.
I have a combobox and list component on the stage. The combobox has 3 selections. How do I get it so that each selection triggers the specific xml file to load into the list component? I can't get them to communicate to each other.
View 1 RepliesHere is a snip from within my code:
[Code]...
The 'recommendations' dataProvider is an ArrayCollection of String, which are generally sentences about as long as this one. By setting the variableRowHeight and wordWrap properties as shown, if a sentence is too long to fit on a single line, everything works fine- the row expands and the messages show on two lines, or occasionally three.
The space allocated for this panel within the entire canvas means if the total text size of 'recommendations' exceeds six lines, I need for the entire list scroll. This is also working just fine. The trouble is when using the mouse wheel to do the scrolling- Flex scrolls both the entire list and the single item where the mouse is hovering. Often this results in only the second half of a sentence being visible. Non-programmer friends I have asked to look at this noticed this, and tell me it as a problem. If a user does not notice the dual scrolling, and sees only a fragment of a sentence, it will be perceived as an error in the application.
[Code]....
I want to add a SimpleButton to a list item in a list component. I am getting the CellRenderer for the list item I want and using the addChild method to add the simple button. The button appears in the right spot on the list item but it doesn't function like a button. It's like the contents of the buttons first frame is added to the CellRenderer and nothing else.
View 1 RepliesWhen a user selects a category from the first drop down box then i want the 2nd drop down to be updated based on the selection of the first drop down. I have created multiple ArrayCollections whose names are set to the "data" values of the first drop down, for instance:
[Bindable]
public var countries:ArrayCollection = new ArrayCollection([
{label:"USA",data:"USA"},
[code].....
I am currently working on a project in Flex and I am having a hard time having a list's contents ALL be selected by default. Wondering how to do this.
<mx:List id="list" dataProvider="{dp}" allowMultipleSelection="true"/>
I'm just trying to have the list all selected.
Why I have to press 2 times the arrow key down to get a navigation through the list items in a list component of Flash?
Theres any workaround for this? I have a listener for keyboard event that checks if keyCode is equal to 40 if it is then I use 'stage.focus = list', but I have to press 2 times key arrow down to start navigating through list items.