473,662 Members | 2,352 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Import a Text File in Flash

88 New Member
Hi,

I'm developing a flash game and need to read data from a text file (about 100k). I do not want to read it from an external file.

-Is it possible to somehow import a text file into flash and compile swf without a need for an external file to read at runtime?

-How about putting the huge data into a string object defined in an .as file? Or is there a specific class to handle such data?

Let me know the right direction to do it.

FYI, the text file contains a list of words (I'm making a word game) and I split the list into an array.
May 23 '09 #1
6 5112
Markus
6,050 Recognized Expert Expert
Create an array of the words in a AS file that is compiled with the program.

However, I don't recommend this; what if you want to give updates to the word list, or what if you wanted to allow the user to add their own words? A separate file would be best.
May 24 '09 #2
serdar
88 New Member
Do you mean hardcoding thousands of words (by copy/paste of course) as:

Expand|Select|Wrap|Line Numbers
  1. var wordList:Array = new Array("apple", "orange", "banana");
I'm trying to protect the word list and don't like to do encryption in the text file.

With this method I still can have an external file for users to add new words (I don't think it's likely so in this kind of a game though) and append it to the compiled array.
May 24 '09 #3
unauthorized
81 New Member
Anybody can see the source code for your flash object, so putting it inside the script won't make much difference. If you want to keep your word list safe, you have to use an encrypted SSL communication and a server side script to supply words.
With that said, there are hundreds of scripting languages (Python comes to mind) that can write the code for you from the word list. It would take <1min to write one.
May 26 '09 #4
serdar
88 New Member
I just need to hide it from the average people who like to add the game into their website. I don't like the idea to include a plain text file to the zip archive.

Maybe I should also add a simple encryption to make it harder to get the words by viewing the binary code of the swf (or by using decompilers?), but it's not that much important actually.

About using a scripting language; do you mean generating the .as file from the plain text file? I do have some 'filtering' scripts (PHP) to pick appropriate words in a larger word list so I can easily use them to generate the .as file too.
May 26 '09 #5
unauthorized
81 New Member
Yes, this is exactly what I mean by "scripting" . You would have to do something like this pseudo code:

Expand|Select|Wrap|Line Numbers
  1. echo "var wordList:Array = new Array( ";
  2. while(! word_list.empty() )
  3. {
  4.      echo "\"";
  5.      echo word_list[0];
  6.      echo "\", ";
  7.      word_list.erase(0);
  8. }
  9. echo " );";
You don't have to generate the whole .as, just the long and boring part that is easy to automate.

As for keeping people from putting your flash on their website... don't bother, it won't happen. The biggest corporations can't figure out how to keep binary machine code executable warped through the 9 circles of hell (read: SecuROM) from being mass copied, so your Flash object stands no chance. Some basic URL checks will be effective enough against people who know too little to rip the decryption key out of the dissembled script.

If you still want to go through it, you will probably want to take a look at http://code.google.com/p/as3crypto/
May 26 '09 #6
serdar
88 New Member
Okay, that's how I thought when I think how to convert the word list into an actionscript array.

As for keeping people from putting your flash on their website
Actually, I do want them to download and use the game in their site (probably with high scores functionality disabled etc.). Just not prefer to deliver a plain text file.
May 26 '09 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

1
1608
by: Dave | last post by:
I don't think the text file is caching. The information in the text file is called upon manually by the user of the flash movie. Odd that the variable in which the text is stored doesn't clear once the page is revisited. Flash can't permanently store the information without having Shared Objects set up. (And they are not set up) I don't understand how the text file could be cached since the user manually requests the information after...
1
9745
by: DCM Fan | last post by:
Access 2K, SP3 on Windows 2K, SP4 All, I have an import spec set up with quoted Identifiers and comma-separated values. The text file is produced by a 3rd-party program of which I have no control. It outputs all text fields surrounded by quotes, and all numeric fields w/o quotes. All fields are separated with commas. This has been working for 2 years, until today, when one of the data fields
1
8175
by: mark | last post by:
In Access 2000 and 2002, I have created an import specification to import the fixed-width recordset below into an existing table. I am having strange problems with the import of the date and time fields. 177 102003 16:43:12 102003 18:43:12 6OAG0ADP Y 0000 0000 0000 0000 61930 4HGA800 165 102003 17:43:12 102003 18:44:12 6OAG0ADP Y 0000 0000 0000 0000 61930 4HGA800 177 102003 16:41:18 102003 18:45:12 6OAG0ADP Y 0000 0000 0000 0000 61930...
1
6691
by: Dan | last post by:
Could someone please help me with auto importing a series of data files into an Access table. I tried to follow code given below in a previous messagebut i'm getting error messages. Here's my database stats: Path: C:\Database (contains the database and all the text files to be imported) Text files to import: (SampleData4.txt and SampleData3.txt as testing examples)
3
3706
by: deko | last post by:
I've been trying to use the Access Import Wizard to expedite importing data into my mdb. The nice thing about the wizard is that I can import from different file formats - txt, xls, even Outlook - and dump everything into a table. The problem is once I have the data imported into a new table, I can't do much with it. If I try to run an Append query and insert data from the new table into an existing table, the query fails - "Error...
1
3764
by: ghadley_00 | last post by:
Hi, I have a MS access database table for which I regularly need to import fixed width text data. At present I have to to cut and paste the text data from its source to a text file, save the file, import the text file as fixed width text , and then run an update query to copy the appropriate info into fields of a different table. Is it possible to write a macro to do all these steps? Also, is it
3
5425
by: brianwalker | last post by:
hello all. I have a text document that stores text for use in a flash movie. I'm also using PHP to displace the same text on another page. However the text document includes 2 tags for use by the flash movie... title= and &content= ... see text file at end of post .... when i use the php command <?php include ("info.txt"); ?> it also displays those tags. Is there any way to use php to just display what apprars after the &content= in...
2
3733
elamberdor
by: elamberdor | last post by:
Hi All! Well, i'm modifying a dynamic map, with lat and long datapoints, my problem is it loads in text perfectly onto exact points I specify on the map, ..well now I want to load in icons(images) instead of text. (yes i'm being difficult) and i'd like the text to load into a static placeholder symbol instead. Problem is, I can get images to load in a separate file, text to load in a separate file, and text to appear in a static...
0
3891
by: whochrisporter | last post by:
Hi, thanks for reading and helping me first of all. Now to the question.. I need to load external images into a scrolling slideshow (its like a sliding rotating banner) flash file using an external text file. I think I may have the concept down, I'm just not good in coming up with my own script. I was thinking to use the loader component because for the sliding to work, I have to set the images (5 of them) next to each other so every few...
0
8432
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8343
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8762
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8633
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7365
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5653
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4347
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1992
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1747
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.