Flash Question
- Started
- Last post
- 12 Responses
- solo
Hi guys... an AScript newbie here, so please be patient ;)
i`m trying to solve this problem:
i have an external .txt file, containing a generated number in a format like this: 12 345 678,90 (with spaces and the coma)
i`m trying to parse this number to the flash animation, and want to get rid of the numbers on the right side of the coma (9,0).
The problem is, that flash recognizes this parsed number as text and i`m basicly stuck :(can someone point me to the right direction or help?
pretty please?
- UndoUndo0
you should be able to use strict data typing to convert it. define a new variable as a number and make it eaqual your imprted variable that is a string. i.e
newVar: Number = impVar
- solo0
thanx, that`s how i`d done it.
BUT the problem is, that there`s a space in the imported variable (eq. 12 _ 2586_58464216 ), so it parses only the first two numbers - 12.
what i basically need is to ignore the spaces in the variable when parsed.
thanx, any help appreciated
- bk_shankz0
You're going to have to use a string function. try searching for the , with
String.indexof
and then taking out the comma with
String.slice and then converting to a number. There's a bunch of String methods that can help you.
- ********0
use xml??
or step through the characters and
delete spaces??
- solo0
thanks shankz, i`ll give it a try and lookup the string function.
cheers mate ;)mx > sorry, i cannot modify the given .txt file, as it`s provided by a third party...
- System-Idle0
parse the imported var with a for loop using var.length
add each letter to an new var as you go (using substring)
when var.substring(i,i++)
equals ,
end for loop.
(i is var used in for loop)
- bk_shankz0
Yeah if you're getting the filr from another server you're going to have problems. You can only read a text file off your server. There might be a way to fix this now but I don't know what it is.
- ********0
the cross domain policy file will be your friend here.
- UndoUndo0
listen to dem MX_onD and System-idle fellas they knows whats happening here!
- solo0
thanx guys, it works for me with the string.slice function ;)
positive karma for you all! :))
*happily jumping around the cubicle*
- System-Idle0
http://www.macromedia.com/suppor…
you can creat a file on the server yr pulling data from which the flash player look for
- ********0
thank you UndoUndo,
good link System-Idle
solo, try this link too for the cross-domain-policy-file example
http://livedocs.macromedia.com/f…
for this you will need to be able to upload this file to the sesrver which holds the text file.
On a side note this often trips people up because it works when you're testing your flash movie on your machine, it only starts not working when you upload it to your server...