ActionScript 2.0 :: Adding Items To A Listbox Using Functions?
Apr 11, 2003
i am learning to work with sharedobjects in flash mx, and i am trying now do to a little application, and in this application i will use a listbox to do some things, i have a message board that will keep the messages in the sharedobject named "visitas", i add data with a function, ,here it is:
function salvaMensagens(){
var num = Number(_root.entradas.text);
visitas.data.mensagens[num] = _root.mensagem.text;[code]....
it had to add the name digited in the input text field name, and the same with the email, respectivelly , label and data, but my listbox is still empty after several tryes..
View 2 Replies
Similar Posts:
Aug 18, 2006
I just want to deselect everything in a listbox. I have tried:
[AS]
myList_list.selectedItem = null;
myList_list.selectedItem = undefined;[/AS]
but it wont work.
View 4 Replies
Feb 22, 2007
Came across yet another obstacle today and was wondering. How would i permanently highlight specific items stored within a list box (flash component) if, say an error occured. Moreover, how would i highlight them red instead of green?
View 1 Replies
Jun 20, 2004
I've gotten as far as getting a listbox with a list of articles to display the articles in a dynamic text box, only i can only get it to work if i use one huge external text file that contains all the articles. what i want is to have each item on the list open up its own external text file, i.e. for each item on the list, there exists a separate text file. I'm about ready to put my fist through the monitor, and that would suck because this is a really nice monitor
View 13 Replies
Oct 26, 2009
How would I go about evaluating an array of strings as function calls?Something like this:
ActionScript Code:
var my_mc:MovieClip;
var myArray:Array = new Array("function1()", "function2()", "function3()");[code]....
I get an error "Instantiation attempted on a non-constructor".In this case, I'm trying to dynamically add linked movie symbols from the library. Perhaps I'm going about this the wrong way... ?
View 4 Replies
Jun 3, 2010
I have entered the following code and both items do import, but i cant control the label of the second library item called "Cool"After doing some digging, i think i found out the class name of the second object was called "Cool" and the base class was "import flash.display.SimpleButton;" so it looked like i had to import that class at the top like i did! But still not working. and still no joy!I think i need to add in "public class Cool extends SimpleButton" so it inherits the SimpleButton class after the first public class and then create a new function called "public function Cool() " and then add the function body but when i go to do that it all goes wrong. Am i on the right track or am i missing a trick!!
package
{
import flash.display.Sprite;
[code].....
View 3 Replies
Apr 27, 2010
I am trying to learn how to add sub menu items to my main menu which is being generated using XML. I have been able to add the top level menu items but I am not sure how to integrate the sub menu items. a link to my development site [URL] In my code I have a variable showInMenu this value is true if it is a top level menu item and false if it is a sub menu item. If I list out the XML menu items they look like this where About Us is a top level menu item and Our Mission is a sub menu item of About Us. how to set up the sub menu items. I attached the fla with xml file.
[Code]...
View 0 Replies
Feb 24, 2009
I've got a combo box adding items from an array. The labels are working just fine, but adding the data with a variable won't work for me. If I put in an actual number, I get that result, but trying to add it with a variable I always get 1 as a result. classData only ever = 1. I can access the array. I know it must be in the syntax.[code]
View 2 Replies
Mar 3, 2011
The buttons search and find the movie clip in the array flawlessly, but I'm having trouble adding a transition to every movie clip as it is appears. Most tutorials on transitions require a specific instance name, but I want ALL instances to have a transition. Heard the .getChildAt() method is the way to go but cannot find solid guidance on this. Here is the basic code:
Quote:
var myDishArray = [chicken, steak, tuna, pasta, iceCream];
for each (var btn in myDishArray) {
btn.addEventListener(MouseEvent.CLICK, onDishBtnClick);
[code]....
how do I properly use the transition manager or add a transition code?
View 2 Replies
Mar 3, 2011
Found some great code that adds Button Event Listeners in a loop. The buttons search and find the movie clip in the array flawlessly, but I'm having trouble adding a transition to every movie clip as it is appears. Most tutorials on transitions require a specific instance name, but I want ALL instances to have a transition. Heard the .getChildAt() method is the way to go but cannot find solid guidance on this. Here is the basic code:
Quote:
var myDishArray = [chicken, steak, tuna, pasta, iceCream];
for each (var btn in myDishArray) {
btn.addEventListener(MouseEvent.CLICK, onDishBtnClick);
[Code].....
how do I properly use the transition manager or add a transition code?
View 1 Replies
Sep 20, 2009
how do i go about adding the values of array items together? basically i have an array of randomly sized rectangle sprites and i want to find their total length (as if they were lined up end to end)
View 3 Replies
Feb 4, 2010
1. An XML list, which works just fine, retrieves between 3 and 15 strings (or menu names). These menu names are put into an array called, "aGalleryMenuID".
2. I want to be able to create a MovieClip and TextField dynamically for each string and place them on the stage dynamically. So if there are only 5, it will make five. 3 will only make 3. The long way of doing this is to create 15 MovieClips and 15 TextFields and use a loop to use addChild. This is okay, but what if later it is decided there needs to be 30 menu items. I want to avoid that and make this future proofed.
for loop that loops through the # of array items in aGalleryMenuID
set the MovieClip's name to a unique identifier
set the TextField's name to a unique identifier
[code]...
View 2 Replies
May 21, 2010
I am new to Flex. What I am looking for here is adding a click handler on all the items created by a SkinnableDataContainer. I tried several things that didn't work, and I have no idea what is the right way to do it.
<s:SkinnableDataContainer id="teamList" itemRenderer="TeamSummaryRenderer">
<s:dataProvider><s:ArrayList>
<fx:Object teamName="A super team 1"/>
<fx:Object teamName="A super team 2"/>
<fx:Object teamName="A super team 3"/>
</s:ArrayList></s:dataProvider>
</s:SkinnableDataContainer>
Furthermore, I don't want to declare the handler in my custom TeamSummaryRenderer component. I would prefer that the handler code stays at application level.
View 3 Replies
May 24, 2011
I want to iterate over an ArrayCollection in Flex while there can be items added and removed.
Since i didn't find a way to use a "classic" Iterator like in Java, which would do the job. I tried the Cursor. But it doesn't really work the way i want it to be ;) So how do I do it nicely ?
var cursor:IViewCursor = workingStack.createCursor();
while (!cursor.afterLast)
{
[Code]....
View 5 Replies
May 24, 2010
What I want to do is be able to click a button that adds an Item to the stage and then you are able to drag the item around on the stage. I know how to do these things separately as in if the item is already on the stage I know how to add the code to drag it and I know how to create a button that brings a library item on the stage. How would I combine the two?
View 7 Replies
Jan 6, 2011
I'm trying to make a flash version of those refrigerator magnet poetry kits. As such I have about 150-180 little MCs each with a different word. They are all named sequentially, so theoretically I could just make some array counter or something to stick the handlers on right?
View 5 Replies
Aug 30, 2009
I'm making a multiple choice game and I have a dynamic text bok which says "correct" or "incorrect" accordingly. also want to make it automatically "gotoAndPlay" the next scene but I can't figure out how to tell it to both change the text in te text box and move to the next scene after they have answered the question. The "gotoAndPlay" always seems to overwride anything elseso I have the following so far:
ans3.addEventListener(MouseEvent.CLICK, checkquestion1c);
function checkquestion1c(event:MouseEvent):void{ ans1.removeEventListener(MouseEvent.CLICK,checkquestion1a);
[code].....
View 1 Replies
Dec 8, 2008
I have a DataGrid set up and have the XML data nice and cozy inside of it, but I have a bit of a snag. The data I'm importing comes from a few separate files but the DataGrid ends up displaying all of them, so the rows are a bit of a jumble initially. Is there a way to tell the DataGrid, AFTER it has all of it's data, to sort itself out alphabetically based on it's first column?
View 3 Replies
Jul 18, 2011
My company recently contracted an outside web developer to create our new website. I have some experience with Flash, but not beyond basic timeline controls. I've been given the task to update the flash element that has a horizontal carousel. Inside, there's three series, each with 6 buttons. The controls are a left and right arrow button on either side. I added a new button into the series and moved each of the series so they no longer ovrlapped.The carousel should just rotate through continuously, but it returns to the start after 6 clicks. Please let me know if there is any other materials I need to provide. Did adding in another button change the positions in the code? If so, what do I need to do to fix it?
[Code]...
View 1 Replies
Feb 16, 2011
I have a for loop wich passes 11 times:
private var currentItem:uint;
for(var i:uint = 0;i<10;i+){
addChild(arr[currentItem]);
[Code]....
So the problem is that the array only contains 6 items. So when it comes to the 6th item the currentItem resets and the next 4 items that are getting added are the 4 first from the array again. Now when i trace the items, the last 4 trace "null". how can i add items from the array multiple times without losing its properties etc?
View 1 Replies
Jan 18, 2010
I am working on a new site, and in the site items from the library are brought on to and taken off the main stage through a handful of functions in the document class. I also have a main menu class that is responsible for building and adding menu items. The way it is built currently, these menu items must somehow reach into the document class and call the functions I created earlier, but I am unsure how to do this. Most things I find on how to call a parents method end with the person saying if it built correctly you shouldn't be doing this at all.
View 1 Replies
Jan 14, 2012
Code:
function AddYCoins():void
{
for (var i:int = 0; i < 10; i++)
{
var Ycoin:YCoin = new YCoin();
[Code]...
This function creates 10 instances of my YCoin and places it around the stage. But i wish the coins to only fall in specific areas, (i.e. i have 8 green rectangles, names area1,area2 etc) because the idea is you have to collect the coins but only staying on the green rectangles.
i knows its the stage.stageWidth i need to change but i cant think what to change it too!
View 14 Replies
Feb 27, 2012
What is the best way to make a menu with items that can be bought ( a.k.a shop ), bought items are invisible and there are about 20 items or so. What's the better approach than adding mouse event listeners to all 20 items?
View 2 Replies
Oct 8, 2009
I want to add a function as a property something similar to this is what i'm looking for (only that this generates an error).
ActionScript Code:
function getPosition():Point {
return new Point(this.x, this.y);
}
[code].....
And i know i can create a class in an external file. But this is supposing i want to keep it in the same file. And i know that is not a good idea either, but just assume that i have a valid reason.
View 3 Replies
Feb 15, 2008
i were trying to add onRollOver to a movieclip that i loaded with loadMovie(). But i were unable to give the MC functions. How would i add functions to a external MC? I did like this (Wrote from top of my head, sry for syntax error)
ActionScript Code:
container.loadMovie("dummy.swf");
container.onRollOver = function (){
[Code]....
The onRollOver function do not work,but the movie gets loaded, how to work around it?
View 7 Replies
Sep 1, 2009
I currently have a movie where I have an icon (image) and a block of text as a clickable button (locked together) the button takes you to a specific urlActionScript
Code:
on(release){
geturl("[URL]");
}
What I need to do is replace the geturl with some script that will add an alert box with 2 options. I would like the box to have a title something like "Where would you like to go from here?" then two text links "Members Excel" (which will take them to members-excel-forum) and "Newsgroup Excel" (which will take them to newsgroup-excel-forum), like I said I have many more to add but once I have the code and a "How to" I should be able to adapt it.I will have to do this for each of the items (I'll have to unlock them first) there are 24 items in my movie (it looks like 12 as there is an icon and text locked together for each category) so I need to do this for 16 of them, I say Alert box as this won't be bothered by a pop up blocker. The Code [URL]
View 3 Replies
Aug 17, 2011
I have s:list component in my MXML and a different actionsscript file which does the socket connection to the server.Everytime a user is connecting to the server I'm sending to all clients the updated users in the server by sending strings of ports (port for each user).Now, when the data gets to the client (to the action script file SocketData function), I want it to be added as an item to the s:List in the MXML file.
View 2 Replies
Oct 11, 2005
I am having trouble accomplishing the following:
Code:
var some_xml:XML = new XML();
some_xml.onLoad = function(success) {
if (success) {
[Code]....
This works fine if I use a number, but as soon as I try to use "n" within the function it throws an error. Would eval do this for me? I haven't used eval before.
View 7 Replies
Oct 5, 2010
I have what I think is a scoping issue with a listener. I have a movie clip which contains several picture management functions. I want to add a listener to it so that the next image loads before it is processed. Where do I put the listener - In the MC or in the root? At the moment, I have it in the MC but it does not run the function. I created a test function in the root which runs the listener no problem.
View 2 Replies
Sep 9, 2010
Say I have 3 fla files, each with it's own document class. I want to define some unique variables in each of those 3 files.Now once the variables (unique to each fla) are set, I want to call the same function - setting up the files. I want this function in a separate as file so i only have to make changes in one spot.How do I link the 1 .as file to each of the 3 doc class files and have it's function called in the constructor of each on
View 2 Replies