View Full Version : Loading external .txt or .html files inside of a Text Area using a button to trigger?
ryan@eventstrea
02-07-2005, 09:11 PM
Right now I am using buttons to change the .text variable in a Text Area.
Is there any way to dynamically call up an external .txt or .html file to replace this .text variable while still using the button as a trigger? I need to do this for ease of editing in the future.
Current Code:
on (press) {
_root.text_area.text = "Halllo";
}
Thanks!
on (press) {
loadVariables("a.txt", _root.text_area);}
in the "a.txt" file
text=Hallo this is a test text just repleace me
kyuukisan
08-30-2005, 03:02 AM
is this used on/in the action layer of the document or on the button itself?
kyuukisan
08-30-2005, 03:13 AM
I believe I m having the same Problem. I'm Learning How to build a website with flash and I want to use my buttons as a "internal Frame" (like in html)
theiceman
08-30-2005, 10:14 PM
another way of acheiving this is to add the following code on a frame (making it much easier to find and change code at a later date.
All this code should be added on a frame, preferably on the _root of your movie:
Create a loadVars object to load external data into;
loadVobject = new loadVars()
create a function to perform when textfile has completed loading and assign external data to a textfield for display in flash:
_root.loadVobject.onLoad = function() {
_root.myFlashTextField.text = this.description; ###### see below
_
};
attach event code to required button:
buttonToTriggerEvent.onRelease = function(){
_root.loadVobject.load("myTextFile.txt")
}
Ok, above you will see I put a load of ### next to the bit of code that assigns "this.description" to the flash textfield.
In you textfile named (myTextField.txt) put "description=then all your text here and here and here and so on and on etc. description is just a name I have chosen and can be almost anything else. It will act as a property of your loadVars object when loaded into flash and can be referenced like this :
_root.loadVobject.description
Thats it really.Hope I have described this well enough, its kinda tricky but is the best way really. Its very easy to update as all you will have to do is change your textfile and synch it using your ftp program to see the changes updated on your site.
If I can help more just let me know.
L8rz,
Ja
kyuukisan
08-31-2005, 01:32 AM
If this helps any ,
I checked out another forum and using the following steps I was able to make a button load a external swf in to a window.
1 create a document. Add a button to the stage
2. convert the button to movie clip
3. Create an shape (rectangle or square or whatever) on the stage,
* Change the fill color to transparent
* Give it a set size
* Convert it to a Movie Clip
* give the instance a name
4. Create another swf. This will be the document/ movie you want to load into the shape.
*Make its' size the same size or smaller than the shapes size.
5 in the main document select the button and in the behaviors pane
click "+" >
MovieClip>
LoadExternalMovie
6. Follow the dialogue and test the movie
I hope this works as well for you as it did for me.
vBulletin® v3.7.1, Copyright ©2000-2009, Jelsoft Enterprises Ltd.