Solved

Best way to import external text in Flash

Posted on 2007-12-05
4
1,027 Views
Last Modified: 2010-04-21
Currently, we are using 15 spreadsheets to edit the data. We are creating a new EXE to manipulate the data in arrays in Flash 8 Pro. We will eventually use Flash CS3/Flex to manipulate the text.

I think the best method of importing the current data is to export the spreadsheets to a .TXT file and save into a string and manipulate the data then. However, when I export the spreadsheet to a tab-deliminated file, it seems to miss the initial tabs on the first row and only sees the last tab on the second row.

The example of the file is as follows:
matID      Benefit      KPIs      trueMatID      KPICount      KPI COUNTS
PFM_1      Test Text      PFM_2      86      -
PFM_2      Test Text      PFM_2      219      -

I have code that is the following:
tabPosition1 = textOnScreen.text.indexOf(Key.TAB);

Why does it not see the first tab location? Or what do I change so that it sees the first instance of a tab.

OR - is there a better way to import the spreadsheet data or a database solution for Flash? We are currently using Director and v12, but want to convert to Flash CS3/Flex soon.
0
Comment
Question by:msukow
  • 2
  • 2
4 Comments
 
LVL 37

Accepted Solution

by:
CyanBlue earned 500 total points
ID: 20419702
Well...  There is no tab character in front of each line...  That is why you are not seeing one...

If you parse your data with the for loop, you can get all the elements...

A better approach would be saving the spreadsheet data to a database and have Flash call a server side script to fetch the data you look for...  Unfortunately a server side script is required if you use Flash unless you are using something liek AIR...

CyanBlue
var _lv:LoadVars = new LoadVars();
_lv.onData = function (raw)
{
//	trace(raw);
	var r_arr:Array = raw.split("\r\n");
	for (var i:Number = 0 ; i < r_arr.length ; i++)
	{
		trace(r_arr[i]);
		var t_arr:Array = r_arr[i].split("\t");
		for (var j:Number = 0 ; j < t_arr.length ; j++)
		{
			trace("\t" + t_arr[j]);
		}
	}
}
_lv.load("ExcelData.txt");

Open in new window

0
 

Author Comment

by:msukow
ID: 20419847
Looks pretty good -

However, we need to the the tool self-contained for half the clients - there will not be a server that we can connect to for at least 50% of the users (due to firewall restricts or lack of a internet connection in many areas in the world), the other half with have a connection and the firewalls issues will not be a concern. In that case we will be connecting directly to the database on our servers. We are interested in AIR and it looks like it may be what we need locally (especially if we wait 6 months before inplementing).

Will AIR be something that can be implemented easily, or is there training needed to set up the correct production environment?
0
 
LVL 37

Expert Comment

by:CyanBlue
ID: 20420119
Well...  AIR sounds like the tool you are looking for...  The big huddle will be that AIR uses ActionScript 3.0 which is somewhat new...  If you are comfortable with learning new language, it won't be that hard to achieve your goal...  ;)

The only concern is the timeframe...  It still is not a real product, so I don't know how much will be changing down the road and if you are allowed to create a commercial app with it...

CyanBlue
0
 

Author Closing Comment

by:msukow
ID: 31412860
Thanks for all thoughts as well.
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Best way to Display MP4 Video 5 310
Text To Speech Reader For Adobe Flash Pages 4 899
Adobe flash player fails to install 12 304
How to convert image files to a movie file 6 111
There are times in your Flash CS4 application when you want more than a simple pointer or a hand, and it's hard to find an ideal walk-through to tell you what to do.  I spent a few days recently learning my way around making custom cursors in Flash,…
I have been doing hardcore actionscripting for some time; and needless to say I have faced a lot of problems in just understanding others' code rather than understanding what the code executes. A programmer's life can become hell when there are a lo…
The goal of the tutorial is to teach the user how to how to record live broadcast.
The goal of the tutorial is to teach the user how to select the video input device. Make sure you have an input device that in connected and work and recognized by Adobe Flash Media Live Encoder and select it in the “video input” menu.

813 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

9 Experts available now in Live!

Get 1:1 Help Now