A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: [F8] Using .txt to fill in sections of actionscript?

  1. #1
    Senior Member
    Join Date
    Jul 2006
    Posts
    104

    [F8] Using .txt to fill in sections of actionscript?

    Is there a way to be able to place a .txt file within the same folder of a swf, and have what the .txt file says be placed somewhere within the actionscript?

    For example, If I have a movie clip, and there are three different functions that make the MC do something. But I only want one of them to play through designation of an outside file. I just have to place a .txt file in the folder that says "function1" And it will call that function in the action script.

    Example idea.
    Code:
    function function1() {
    	mc.play();
    }
    function function2() {
    	mc.loadMovie("picture1.jpg");
    }
    function function3() {
    	mc.onEnterFrame = function(){
                 	if (this.hitTest(_xmouse, _root._ymouse, true)) {
    		this.nextFrame();
    	} else {
    		this.prevFrame();
    	}
    };
    }
    //pick whatever function
    then have it pick which function. instead of just typing function3(); in the action script. Have it be whatever is in the .txt file. That way you can pick what function is played by just changing the .txt file.

    I'm hoping what I want to do makes sense. Help would be very much appreciated

  2. #2
    Senior Member
    Join Date
    Aug 2000
    Location
    Montréal
    Posts
    14,141
    Not that way:

    what you will get from the textfile are variables, not "blocks of code".
    Use these variables in your script, so that you'll get the actions you need.
    You could use a case statement.

    gparis

  3. #3
    Senior Member
    Join Date
    Jul 2006
    Posts
    104
    Seems really complicated... I am going to have to study up. I'm not even exactly sure how to use a .txt file to enter text anywhere. Let alone with using a case statement. Thanks a ton for pointing me in the right direction

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center