1

flashvars を介して swf にロードされるテキストファイルがあります。

  • データはMysqlに保存され、
  • データはcoldfusionとcfqueryを使用して保存されます
  • データはcoldfusionによってテキストファイルに読み込まれます
  • ファイル名を flashvars に渡すことによって、データが swf にロードされ、次に actionscript に読み込まれます。

問題は、最初のテキストまですべてのテキストが初期化されることです。

&quote;

これをどのように回避するか、またどの時点で回避する必要があるかはわかりません。

私はcoldfusionを使用して元のテキストを保存しており、データをhtml編集形式に設定しています

#HTMLEditFormat(form.content)# />

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

以下は完全なアクションスクリプトです

// 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();
4

1 に答える 1

1

フラッシュファイルに変数を入力する場合、URLパラメータと同様に、アンパサンドを使用して変数を区切ります。

したがって、フラッシュはこれを読み取ります。

少年はトレイルに戻るとニヤリと笑った。「大きなおじさん、グランサー」と彼は笑った

このように:

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

使用してみてURLEncodedFormat(FORM.content)、フラッシュの変数をエンコードしてください。

于 2012-08-31T16:32:24.143 に答える