Solved

500 Big Ones! How do I Remove a comma from a Flash Array

Posted on 2006-11-13
8
300 Views
Last Modified: 2008-09-05
Hi guys - I hope this is an easy one

How do I remove the 'comma' from appearing in the following array generated in Flash:

numberofItems = A;
// creating the arrays
message = new Array();
// loop to get all the variable names associated with their corresponding array positions
for (n=0; n<=numberofItems; n++) {
    // adding the association of "label1, label2...label#" with items array
    set("label" + n, scrollContent["myMovie"+n].variableA);
    message.push(eval("label"+n));
}

The new variable called 'message' returns the following values:

message=,label1, label2, label3, etc

I would like to remove the ',' comma from the above generated array so it only displays the values label1 then label2

Cheers





0
Comment
Question by:Donavan_usa
8 Comments
 
LVL 34

Accepted Solution

by:
Aneesh Chopra earned 500 total points
ID: 17935271
It seems first element in array gets an empty string..

use following code to remove first element of the array
--------
message.shift();
---------

-Aneesh
0
 

Author Comment

by:Donavan_usa
ID: 17938667
Hi Aneesh - thanks for the response.

Where would you place the above script?  I have tried a number of places and none of them seem to work.  The only place that generated a response is enclosed below - it does remove the ',' but it also deletes the entire previous lable when it does

numberofItems = A;
// creating the arrays
message = new Array();
// loop to get all the variable names associated with their corresponding array positions
for (n=0; n<=numberofItems; n++) {
    // adding the association of "label1, label2...label#" with items array
message.shift();

    set("label" + n, scrollContent["myMovie"+n].variableA);
    message.push(eval("label"+n));
}
0
 

Author Comment

by:Donavan_usa
ID: 17938773
I have done some digging - would something like splice work (please see below) to remove unwanted data in the array?


numberofItems = A;
// creating the arrays
message = new Array();
// loop to get all the variable names associated with their corresponding array positions
for (n=0; n<=numberofItems; n++) {
    // adding the association of "label1, label2...label#" with items array

    message.splice(1, 5, ","); // start at the first index, count to '5' and remove the "," however it does not work

    set("label" + n, scrollContent["myMovie"+n].variableA);
    message.push(eval("label"+n));
}
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 34

Expert Comment

by:Aneesh Chopra
ID: 17943429
just put my code after populating array, after for loop
0
 
LVL 5

Expert Comment

by:blockage1
ID: 17969665
The simplest solution is to change you loop from...

for (n=0; n<=numberofItems; n++) {

to...

for (n=1; n<=numberofItems; n++) {
0
 
LVL 12

Expert Comment

by:SamuelRostol
ID: 18179180
Well, just to put it out there..

You are tracing a Array. Whatever you do, as long as you are tracing the array, the comma's ( , ) will still be there. You'll have to convert it to a String, and then remove the commas.
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

This is a very simple example to help those of you who are still migrating from AS2 to AS3 understand the redesigned event model in AS3. In AS2.0, event functions (that is, the function to be performed when an event is fired) were stored as a pro…
The last time I worked with Flash and Socket connections was in AS1. A recent project required flash connecting to a Socket, and sending receiving information - we figured it would be easy enough - we all know about the socket policy documents and c…
In this tutorial viewers will learn how to create a basic motion tween animation in Flash Open a new document in Flash: Draw/import an image: Press CTRL + F8 to convert it into a graphic symbol: Select a frame (how long you want the tween to last): …
The goal of the tutorial is to teach the user how to live broadcast using Flash Media Live Encoder and connecting it to YouTube to broadcast. Log into your Youtube account, choose live stream settings, start live stream from Flash Media Live Enc…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now