Search code examples
mysqlcoldfusionactionscript-2flashvars

as2, and &quote; in textfile stops reading text


I have a textfile, that is loaded into a swf through a flashvars:

  • The data is stored in Mysql,
  • The data is stored using coldfusion and cfquery
  • the data is read out into a textfile by coldfusion
  • the data is loaded into the swf by passing the filename to flashvars, then being read into the actionscript.

the problem is, all the text is initialized until the first

&quote;

and I'm not sure how to escape this, and at what point I should.

I am storing the original text using coldfusion, and have it set the data to html edit format

#HTMLEditFormat(form.content)# />

The boy grinned as he led back to the trail.
"A big un, Granser," he chuckled

Below is the full actionscript

// This will be the starting position of the textbox

var starting_ypos:Number;

// Load the Flashvars into the script
text1.text = myVariable;
text2.int = mySecondVariable;

// Make a load vars object
my_data = new LoadVars();

// This will be how fast the text box will scroll 
var scroll_speed:Number = text2.int;

// Make my on load function
my_data.onLoad = function() {

// Fix the double space issue
var my_text = unescape(this.content).split("\r\n");
my_text = my_text.join("\n");
my_text = my_text.split("\r");
my_text = my_text.join("\n");

// Set the text in the text box
scroll_text.Text = my_text;

// Set the autosize
scroll_text.autoSize = true;

// Set the starting_ypos
starting_ypos = scroll_text._y;

};

// Load the external text file
my_data.load(text1.text);


// Start the scrolling
this.onEnterFrame = function() {

// Check for hit test with the mask and the mouse
if(!mask_mc.hitTest(_root._xmouse, _root._ymouse)) {

    // Check to see if we are in the mask
    if(mask_mc.hitTest(scroll_text)) {

        // Move the textbox
        scroll_text._y -= scroll_speed;

    } else {

        // Reset the text box
        stop();

    }

}

}

// Simple stop command 
 stop();

Solution

  • When entering variables into a flash file the ampersand is used to delimit the variables, much like URL parameters.

    so flash reads this:

    The boy grinned as he led back to the trail. "A big un, Granser," he chuckled

    as this:

    var1 = The boy grinned as he led back to the trail. 
    var2 = quot;A big un, Granser,
    var3 = quot; he chuckled
    

    try using URLEncodedFormat(FORM.content) so encode the vars for flash.