Iterating Through An Array And Selectively Deleting Items

Dec 30, 2010

I'm making a very short text adventure, not one that will be all that fun, but just so I can learn a little as3. So I was designing a system that splits the persons input into an array of words, and then goes through and takes out unimportant words like "on." To test this out, I quickly (and messily) coded it up, and the only thing you can do is sit on a box. but it doesn't seem to be working. if you type "sit box" it works, but "sit on box" does not.

[Code]...

View 2 Replies


Similar Posts:


ActionScript 3.0 :: Iterating Through Items Gathered In Array

Jun 11, 2011

I have a small problem with iterating over array. I would like to iterate through items gathered in my array in a way of "one at a time" in each muse click event but whenever I'm using a simple loop it just takes all my elements to process. Is there a way to make a single iteration in each click and still increment the index value in loop?

View 5 Replies

Flex :: Iterating Over ArrayCollection While Adding And Removing Items

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

Flash :: Deleting Menu Items In .SWF File

Aug 11, 2009

I am using Adobe Flash CS4 Professional. I have a simple navigation menu that I am trying to edit.  I may be in the wrong place in the file, but when I open the .SWF files I can see the lines of code and I can see the actual navigation menu as it appears on our web site. I have not been able to figure out how to change / edit / delete the line inthe drop down menu that I want to delete on our web site.

View 5 Replies

ActionScript 3.0 :: Time Deleting Items From The Stage

Jul 16, 2010

I've been trying and trying to delete some basic cards from the stage whenever I reset a game, but thus far absolutely zero luck.

[Code]...

View 7 Replies

Actionscript 3 :: Iterating Through Array Of Objects, Populating BarChart, And Saving Each As Image?

Jan 9, 2012

I am creating an option in my application to create a PDF report based on the results from the application.The results are represented as an ArrayCollection of XMLList objects, which I am using to populate a BarChart.To create a screenshot of each result (as a PNG), I am loading the Results Window (a Title Window) and hiding it (visible = false). I am using AlivePDF to add the capture to a PDF report.

I have been using a Timer to iterate through the results, load each result to the chart, create a delay, and then capture the image and add it to the report.

UPDATE.Currently, I am able to iterate through the results (using the Timer), but the chart does not refresh properly before capturing the screenshot and saving as PNG.Essentially,I am trying to see if there is any other possible solutions for iterating through the results and creating a delay so that I may be able to load a result to the chart, capture the screenshot, and add it to a PDF.Is there any other way to do this in Flex?Initially, I was thinking of iterating through the results array using a for loop,but this was not working due to the fact that the results were not loading in time before capturing the screenshot of the chart.

View 1 Replies

Actionscript 3 :: Cannot Access A Property Or Method Of A Null Object Reference When Iterating Over Array?

Nov 8, 2011

i have this method:

private function findConnectedNodes(node:Node):Array{
var test_node:Node;
var surrounding_nodes:Array = [];

[code]......

View 2 Replies

Actionscript 3.0 :: Deleting The Array Value?

Jan 3, 2011

I'm trying to figure out if this is possible?lets say I'm trying to remove the value "3"

Code: Select allvar myArray:Array = new Array("1","2","3","4","5");
myArray.pop();  // removes the last value "5"
myArray.shift(); // removes the first value "1"

How do you remove the value 3 and still have the correct lenght?

View 7 Replies

ActionScript 2.0 :: Deleting From An Array?

Feb 23, 2003

Is there a way to delete a specific value in an array? For example, the array:"Banana Peel,Hippopotamus Leg,Computer Wire,Keyboard"Would there be any way to delete just "Computer Wire" from the array? I found the Array.splice thingy, but it seems that you need to know the index of the thing. Therefore i guess my question is: Is there any way to find the index of a particular value.In the thing I am making, the value could be at any index in the array (it is put in place by the user), so I could not just say Array.splice(2,1,)

View 14 Replies

ActionScript 3.0 :: Deleting An Object Out Of An Array?

Mar 12, 2010

Actionscript Code:
var gameObjectArray:Array = new Array();var gameTimer:Timer = new Timer(25);gameTimer.addEventListener(TimerEvent.TIMER, gameLoop);gameTimer.start();

[code].....

So every 25 milliseconds, a block is being created and it pushed into an array. The for loop cycles through the array and moves the x by 1 for each object in the array. If the x reaches past 300 pixels, then I want to delete the object from the game entirely. The way I'm doing it now yields an error, so what am I doing wrong and what should it look like inside of the "if (i.x > 300)" stuff?

View 6 Replies

ActionScript 2.0 :: Deleting A Element In Array

Apr 3, 2006

var my_arr:Array =['das',2,jack',4,5];i need to delete the element by refering thier index number.

View 3 Replies

ActionScript 2.0 :: Deleting From The Middle Of An Array?

Aug 13, 2004

is there a way to delete from the middle of an array?like if i wanted to take bananas off grocery

PHP Code:
grocery = ["apples", "peach", "bananas", "mangos", "pears", "tomatoes]

View 14 Replies

ActionScript 3.0 :: Deleting An Element From An Associative Array?

Feb 9, 2009

how to delete an element from an associative array? Splice doesn't work and I tried using the delete action but this doesn't produce the desired result....the element's properties become undefined.

View 6 Replies

ActionScript 2.0 :: Deleting Element From As Associative Array

Dec 28, 2004

Lets show some code:

x = new Array();
x['kamil'] = new Object();
x['kamil'].name = "kamil";
x['madzia'] = new Object();

[Code]....

How to remove any element from that array when instead of indexes we have names; such as kamil or madzia. pop, shift, slice, splice and so on... dont work at all.

View 4 Replies

ActionScript 2.0 :: Deleting Array Values And Gaps?

Oct 13, 2005

if i have the following array

myArray[0] = "value 0";
myArray[1] = "value 1";
myArray[2] = "value 2";
myArray[3] = "value 3";

and i delete the second the value. is there anyway to stop it looking like this:

myArray[0] = "value 0";
myArray[1] = undefined;
myArray[2] = "value 2";

[Code]....

View 2 Replies

ActionScript 2.0 :: Creating And Deleting Array Data

Oct 19, 2010

I'm working on a game for my flash class, where you a question pops up and asks you the name of a US state and you guess the state. I have created the 50 states as buttons with the questions. Each state is in its own frame and i need a way to randomly select a state.

After the game begins i need to crate an array with the frames of all states and then have a random() function select a frame from the array and display the question on the screen. After that it needs to delete the frame from the array so the random() function cannot select the same question twice. Once that is done and all of the data is gone from the array then it needs to move on to a different frame where the total number of questions correct is calculated and its display on the screen.

View 6 Replies

ActionScript 2.0 :: Deleting Element From As Associative Array?

Dec 28, 2004

So there is a problem now. Lets show some code:

x = new Array();
x['kamil'] = new Object();
x['kamil'].name = "kamil";

[code].....

View 8 Replies

ActionScript 1/2 :: Selectively Playing A Movieclip

May 10, 2011

What I'm trying to do is show a little explosion movie clip each time the player's ship gets hit by enemy fire.  I thought it would be similar to how my shield powerup works, but apparently it isn't -- or it is, and I'm just doing something wrong.  Here's the code for the shield business, to give an idea of how things are set up.  The shield movieclip is nested inside of the ship movieclip, and it only becomes visible when the ship collides with the shield powerup icon.  It runs for 240 frames, fades out and disappears.  What I'd like to do is have a multi-frame explosion movieclip inside there as well, which appears, plays once, then disappears, whenever the ship is hit.

[Code]....

View 8 Replies

Flash :: Selectively Mask Parts Of The Stage?

Jan 24, 2011

I'm making flash game, and I have the staged masked so your character can only see part of it. However, I don't want the entire stage masked, I only want the "Game Area" masked. Imagine my stage is 800x800. However, the "Game" only takes up the area at the top, 800 by 600. There are 200px at the bottom where I can use for chatting, or displaying information, as your character walks around the game area.

The issue is, I setup my mask, and it masks /everything/ on stage. Even if I have something outside the "game area", it is still hidden behind the mask. So my question is, in my flash application, how can I use my mask in the "game area", and not have other parts of my application affected? Can I selectively put items above the mask?

Edit: Clarifying. My game starts by initialzing the GameScreen object:
game = new GameScreen(); //800 x 600. Declared as class variable
game.y = 40;
addChild(game);

[Code]....

So now, we have my game setup, with a circular hole in the mask and the player can see his character. However, also when the Game Screen object initializes, it places an infomation bar on the screen. This information bar also gets hidden by the mask. The player cannot see it. The issue is, I want this bar (and other components to be added later) to be visible to the player at all times. I can't simply change the shape of the "hole" through the mask, because it moves with the player. So how can I allow that information bar to be seen by the player, while still hiding the game area?

View 1 Replies

ActionScript 2.0 :: Selectively Pre-loading A Movie Clip?

Jul 24, 2007

I'm currently working on a Flash site with AS2 (I made the switch to Flash CS3 in the middle of the project and kept things in AS2 to avoid any potential problems). [URL]As you can see by going to the link the preloader takes a loooooong time. After going through the preloader tutorials I have still yet to find an effective way of making the preloader at the begging load only the opening animation or any other preloaders after that load a specific movie.

View 4 Replies

ActionScript 3.0 :: Array And Splicing Items From Array?

Oct 5, 2009

I am working on trying to collect data within an array (which works) and this data is collected when a button is pressed or selected. I also want the ability to remove an item from the array if the button is pressed again. Currently, I have these buttons dynamically generated and everything works well. The buttons have ids applied to them. SO what I am trying to get working is, if I select button 0, 2, 3 (0 indexing), the data array created holds [A., C., D.]. I want to remove A. after I click button 0. Instead, it seems to cause problems. What I am doing wrong with splicing??? trace statement:

A. items so far selected
selected items are: 0
A.,C. items so far selected

[code].....

View 1 Replies

ActionScript 3.0 :: Accessing An Array Of Items Within An Array

Jan 20, 2010

I'm so proud of myself. I figured this out all by myself and thought I would share. (If you can't tell, I'm new to AS) I needed a way to grab an item in a specific location and have it return an array of items. Here is how I did it:

[CODE]....

View 3 Replies

ActionScript 3.0 :: Shift Array Elements Without Deleting The Elements?

Oct 1, 2009

does anyone know how to shift all the array elements by one or more without deleting the array itself?

Something like rotating the array:

1,2,3,4,5,6,7,8,9,10
10,1,2,3,4,5,6,7,8,9
9,10,1,2,3,4,5,6,7,8
8,9,10,1,2,3,4,5,6,7
7,8,9,10,1,2,3,4,5,6

View 4 Replies

Add More Items To Array For Game?

Oct 20, 2010

I am trying to make my game increase in balls after each level passed by the player.

The script below are all on an enterFrame function
var level:int = 5;
var ball:ball_mc;

[Code].....

View 1 Replies

ActionScript 3.0 :: Sort Items In Array By Name?

Sep 10, 2009

I need to sort String items in an Array. Actually I need to organize children of a MOvieClip inside an Array.

I have a "menu" mc object which has 8 children with names "m1", "m2", and so on..... the last one is "m8" . They are NOT created dynamically.

the children are even organized in layers alphabetically.

i've already tried:

Code:
//for each (var item:MovieClip in menu)
//{

[Code].....

View 1 Replies

ActionScript 3.0 :: Remix Items Of An Array?

May 17, 2011

I have an array a=[0,1,2,3] and I want to get a b array with elements of a randomly distributed. I tired the below code but it is not working[code]...

View 3 Replies

Actionscript 3 :: Filtering Items In An Array?

Jun 17, 2011

I have an array that contains movieclips. All of the movieclips have te type and they are all positioned on the stage next to eachother.

Above the displayed movieclips i have 3 buttons, each simbolizing a type, what i want to do is: i click on one of the buttons and all of the movieclips that dont match the right type should be removed from the stage, the remaining movieclips should then tween so that they are next to eachother again. If i click the button again then the movieclips should be displayed again to where they were and should all be positioned again next to eachother.

View 2 Replies

ActionScript 2.0 :: Targeting Items In An Array

Apr 20, 2010

I'm a bit green when it comes to code and I have a specific thing I need to do which has had me going round in circles (no laughing at the back!). It must be pretty simple but I'm stumped! Basically I have 6 movieclips on the timeline with instance names 'btn1', 'btn2' etc to 'btn6'. These movieclips have an "on" and an "off" state (frame labels)

[Code]...

View 2 Replies

ActionScript 3.0 :: Remove My Items On My Array?

Jun 8, 2010

suppose I have created an Array object with 4 items on it. Now how we can remove that all items without looping process.

View 2 Replies

ActionScript 2.0 :: Get Items From Array In Flash8?

Jul 13, 2010

I am getting number 0,1,2,or 3 as rundom now when I am running following script. How can I get items a1,a2, a3 or a4 as rundom instead of number?

ActionScript Code:
exam_arr = [a1, a2, a3, a4];
ranNum = Math.floor(Math.random()*exam_arr .length);
var exam1= exam_arr[ranNum];

[Code]....

View 5 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved