-
really need help about text
is there's any other way to change the text in flash except using notepad ?
all this time i use notepad to change the dynamic text, but that need 1 txt file for 1 dynamic text
is there's any other way to change all the dynamic text on flash with more flexible ways ?
need your help guys
Untitled.png
maybe I'm old, but I want to learn more
-
.
Hi,
Using the same method as you do for the 1 text, do multiple vars, with notepad like this or similar
Code:
&Title1=Sel darah yang membawa oksigen ke seluruh tubuh adalah...&
&Questiona=Keping-keping Darah&
&Questionb=Plasma Darah&
&Questionc=Sel Darah Merah&
&Questiond=Sel Darah Putih&
-
oh beard, can we hide the notepad or change the format like text.dll
so user cant open the notepad, because it contain the key answer of my game
maybe I'm old, but I want to learn more
-
Client Software Programmer
some domains let you password protect people from going to certain links, so if you do that no one can reach the textfile but you ^ whats your webhost
-
.
Hi,
You don't even need to ask your isp to do it, you could make your own .htaccess file and prevent anybody opening multiple types of files, for example with the .htaccess saved in your root directory
Code:
<FilesMatch "\.(htaccess|htpasswd|txt)$">
Order Allow,Deny
Deny from all
</FilesMatch>
this should give an access denied each time you try to access a file with htaccess|htpasswd|txt extensions
-
i dont get it
would you mind to give the file sample fruit ?
maybe I'm old, but I want to learn more
-
.
Hi,
The .htaccess file is a file that allows you to control your website directories and how people can view your files (or not) and many other things, look it up.
It actually has nothing to do with flash itself.
The example I gave you would prevent people from viewing any .txt file within your directory structure but alas it also prevents flash from being able to read the file (annoying), so best forget that one and search for a different method, there are numerous pages about .htaccess files.
I don't think you will be able to make your own .dll file to do what you want, maybe php and flash!!
-
Prid - Outing
@AanJohnson: To use the code provided by fruitbeard, open Notepad or a text editor, copy and paste his code, and save it with the following name: .htaccess - just like that, nothing else, NOT .htaccess.txt or something like, the full file's name and extension should ONLY be .htaccess - and then upload it to your root directory on your server.
I am back, guys ... and finally 18 :P
BRING BACK THE OLD DESIGN!! OR AT LEAST FIX THE AS TAGS
-
then where should i put this script ?
Code:
&Title1=Sel darah yang membawa oksigen ke seluruh tubuh adalah...&
&Questiona=Keping-keping Darah&
&Questionb=Plasma Darah&
&Questionc=Sel Darah Merah&
&Questiond=Sel Darah Putih&
like this one ?
Code:
<FilesMatch "\.(htaccess|htpasswd|txt)$">
&Title1=Sel darah yang membawa oksigen ke seluruh tubuh adalah...&
&Questiona=Keping-keping Darah&
&Questionb=Plasma Darah&
&Questionc=Sel Darah Merah&
&Questiond=Sel Darah Putih&
</FilesMatch>
maybe I'm old, but I want to learn more
-
Prid - Outing
No, no, lol
Code:
<FilesMatch "\.(htaccess|htpasswd|txt)$">
Order Allow,Deny
Deny from all
</FilesMatch>
This code should stand at is it and be saved as .htaccess and uploaded to root directory of your server
Code:
&Title1=Sel darah yang membawa oksigen ke seluruh tubuh adalah...&
&Questiona=Keping-keping Darah&
&Questionb=Plasma Darah&
&Questionc=Sel Darah Merah&
&Questiond=Sel Darah Putih&
this on the other hand is saved in its own text file. This text file is the one with the answers, and the previous code in .htaccess is to PREVENT anyone from accessing this text file with the answers.
I am back, guys ... and finally 18 :P
BRING BACK THE OLD DESIGN!! OR AT LEAST FIX THE AS TAGS
-
but i didn't upload my program to web
i confuse with this word "uploaded to root directory of your server"
maybe I'm old, but I want to learn more
-
Prid - Outing
Hi,
sorry for the confusion, but I really don't know how to explain that even simpler without using too many words, but I will do that anyways. So, when you are going to upload your quiz game to your website, you will also upload the .txt files with the answers, correct? Then, both of the files (.swf and .txt) will be on your website, and anyone who knows the name of the .txt file can access it by typing the name of it on their browser, like http://www.yourwebsite.com/quiz-answers.txt, but you DON'T want that, right? So, to prevent anyone from accessing your answers text file from your website, you have to write the script written by fruitbeard, save the file as .htaccess, and upload it to your website. BUT, you can't just upload the file anywhere in your website, it can't be inside any folders. It has to be in your main folder, where your index.html file for your website is. Basically, if you use a FTP client to check the files in your website, once you are connected to your website and can see the files, the FIRST folder you are already inside from the beginning, that is the root folder, the main folder, the folder which is the first folder, out of everything:
tut01-structure.png
You have to upload .htaccess file there, IF you want no one to read the answers text file. If you haven't uploaded your quiz game yet to your website, then I suggest you upload your game to your website and also the answers text file, and then you try to view the .txt file by typing www.yourwebsite.com/quiz-answers.txt or something, and you will see that anyone can see the answers if they know the name of the file. Now, create .htaccess files as instructed by fruitbeard, and upload it to your root directory, and THEN view your .txt file from your website again, and see if you can read it now.
Btw, do you have your own website or are you going to upload it to another website?
I hope this is understandable, if not, then I can explain it to you further, but if you have FTP program you are using, then please say so
I am back, guys ... and finally 18 :P
BRING BACK THE OLD DESIGN!! OR AT LEAST FIX THE AS TAGS
-
oh i get it nig
well i have another question
can we edit text inside the notepad from inside flash file ?
maybe I'm old, but I want to learn more
-
.
Hi,
You will most probably need to use php and flash, send and load vars, then you will need to have php write the new text file.
I'm sure Nig has an off the shelf one written around somewhere
-
Senior Member
that's shooting yourself in the foot if you deny people to access your txt file, you deny your game to access it at the same time.
-
Prid - Outing
Originally Posted by realMakc
that's shooting yourself in the foot if you deny people to access your txt file, you deny your game to access it at the same time.
Hey, that's actually a pretty good point ... :/ Oh well, can't think of any other solution right now (does insomnia reduce the number of brain cells? )
Originally Posted by fruitbeard
Hi,
You will most probably need to use php and flash, send and load vars, then you will need to have php write the new text file.
I'm sure Nig has an off the shelf one written around somewhere
probably ... somewhere .... tried searching on Google, but didn't find anything, lol, but it doesn't hurt to write one more, now does it? Besides, it's been a while since I've done PHP, so it should help me remember stuff Also, love your new avatar
@AanJohnson: Below is tutorial on how to edit your text file using Flash
1. Open a new Document
2. Make a new Input textfield, give it the instance name, text_area. If you have a large text file with lots of text, I suggest you keep the font size of your textfield to minimal!
3. Make a button, give it the instance name, save_btn
4. Select your Frame, press F9 to open Actions panel, and type this:
Code:
save_btn._visible = false;
loadFile = new LoadVars();
loadFile.onData = function(data){
text_area.text = data;
save_btn._visible = true;
}
loadFile.load("quiz-answers.txt");
First we just hide the save button before the text file is loaded into Flash, otherwise if someone presses it while the text field is blank, your text file will get empty, lol
We use the class, LoadVars, to load the content of any file into Flash, in this case, a text file, and when it loads, we make the loaded text appear in our textfield, and make the save button visible.
5. Add this code after the above, to the same frame:
Code:
save_btn.onPress = function(){
reply = new LoadVars();
saveFile = new LoadVars();
saveFile.new_text = text_area.text;
saveFile.sendAndLoad("save_file.php", reply, "POST");
}
The last code is used to send and load variables from a PHP file when we press the save button, but in reality we aren't going to load variables from the PHP file, only send variables to it. We are just using the code to make Flash open the PHP file, because when it does that, the PHP code will function and then it will save our edited text to the file.
Basically, we make a new LoadVars object (saveFile), then we create a variable to send to PHP and call it, new_text (saveFile.new_text = text_area.text;), and the value of that variable is the edited text in our text field, text_area. Lastly, we use sendAndLoad function to send variables and also load variables back to Flash (which we aren't going to do, but this can be useful if you want to know if the PHP has successfully edited the text file). Since we can't let the second parameter, which is used to load variables back to Flash, be empty, we just have to create a dummy (a fake) LoadVars where the loaded variables will be sent to.
6. Make a new file, call it: save_file.php - and type this in it:
PHP Code:
<?php
$file = "quiz-answers.txt";
$edited_text = $_POST['new_text'];
$open = fopen($file, "w");
fwrite($open, $edited_text);
fclose($open);
?>
First of all, we have a variable with the text file's name ($file), and another variable, $edited_text, in which the variable sent from Flash with the text field's content is. Then, we open our file in PHP using fopen command, and the "w" is to tell PHP to delete all of the text file's content (because we are going to replace it with the edited text sent from Flash). Next, we write the edited text from Flash to our text file, and lastly, we close the open file for editing.
-----------------------
I feel like this is one of my worst tutorials as it barely explains anything, it just throws a lot of code at you and explains it briefly and poorly without clear indication on which line something is being referred to, and the wording is horrible... I shouldn't even post this, but if it helps you and you understand everything, then that would be a miracle o.O
~ CHECK OUT LIVE PREVIEW ~
Nothing interesting there. Just edit the text, and press the save button. Then, check out the actual text file:
~ TEXT FILE ~
I am back, guys ... and finally 18 :P
BRING BACK THE OLD DESIGN!! OR AT LEAST FIX THE AS TAGS
-
.
Hi,
Yes I said that my example would not allow flash to read the text file either, which was annoying but possibly using
Code:
SetEnvIf Referer mydomain.com internal
SetEnvIfNoCase Referer mydomain.com internal
SetEnvIfNoCase origin mydomain.com internal
<FilesMatch "\.(htaccess|htpasswd|txt)$">
Order Allow,Deny
Allow from env=internal
Deny from all
</FilesMatch>
would only allow internal programs to access the text file or any other you choose to add to the list ???
-
Senior Member
yes if by "internal programs" you mean php script, but then php script will have to send data to flash and they are again vulnerable. unless you resort to server-side logic, there's nothing you can do, apart from encrypting it and so making it harder (but not impossible) to read.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|