|
|
This basic example worked for me. Really need to see more of your code to work
out why it isn't working.
.
on getRandom
if NOT ( ilk( _global.file_list ) = #list ) then
_global.file_list = getFiles()
end if
if NOT count( _global.file_list ) then
alert( "No valid files" )
end if
fileio_instance = _global.file_list[random( _global.file_list.count )]
if ( fileio_instance.getPosition() = fileio_instance.getLength() ) then
fileio_instance.setPosition( 0 )
end if
return fileio_instance.readLine()
end getRandom
on getFiles
file_path = _movie.path
file_name = "Test"
file_list = []
repeat with n = 1 to 10
fileio = xtra( "FileIO" ).new()
fileio.openFile( file_path & file_name & n & ".txt", 1 )
if ( fileio.status() = 0 ) then
file_list.add( fileio )
end if
end repeat
return file_list
end getFiles
|
|