2010-04-21 22 views
0

超級簡單的例子:AS3分裂陌生感

var Path:String="E:\SWF Security\Acess Current Path\Access SWF URL.swf" 

var Path1:Array = Path.split("\\") // Split using the backslash as delimiter (No limit the number of returned tokens) 

trace(Path1) 

你期望路徑1是? E:? 沒有它的E:SWF SecurityAcess當前PathAccess SWF URL.swf,我不知道爲什麼。

+2

啊,它只是因爲我硬編碼的字符串沒有逃脫它... – coulix 2010-04-21 16:43:06

回答

1

在這種情況下,您應該在路徑中使用正斜槓而不是反斜槓。當您嘗試加載文件時,AS3會將它們視爲相同。

然後,您可以使用Path.split(「/」);