Solved

Best way to import external text in Flash

Posted on 2007-12-05
4
1,050 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How to put actionscript code for a button? 6 155
Software Restriction Policy 8 894
Begin mp4 video on first frame 6 194
free photo watermark software 5 105
This is intended to introduce all collision detection principles in flash, their strengths, weaknesses and workarounds. The main method for Collision Detection in flash is using hitTestObject. But unless you'll be pushing rectangular shapes without …
I have found that much of my time doing support ends up being a constant repetition of the same steps to different people.  Early on I stated using web pages with Frequently Asked Questions (FAQs) to alleviate most of the burden.  Sometimes this jus…
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 how to record live broadcast.

734 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