ActionScript 1/2 :: CharAt Is Returning ASCII Values?
Feb 20, 2011
I'm running some script using the charAt() function, that is supposed to return the character at specific indexes in a string, however for some reason it is returning ASCII values.
I need to load data from a database, so I created the following function and placed it in frame 2 on the main timeline.
Code: getQuestionSet = function (category:String, subject:String, level:Number, count:Number):Array { var questionSet:Array = new Array(); var writeV:LoadVars = new LoadVars();
[Code]...
Whenever I try to call the function, it fails to set the value of the questions array. It always appears empty(questions[0]-questions[10] have the value undefined). But, if I check the values from within the function after I have set them, it works, so I know that it is receiving the values. What am I doing wrong?
Code: questions = getQuestionSet("Art and Music", "Art", 1, 10);
Here is an example of how I have would call the function.
I am getting variaables from a mysql database and then returning them back to the main file. However, the script is going faster than the query. is there a function that can make the file wait until it has finished loading in the variables.
I'm trying to take an xml object, parse through it, turn the appropriate elements in object properties. Then, finally, pushing each object an array. Then I need this array accessible outside of the XML.onLoad() function (since it returns nothing, I lose my array).
Here's the code from my timeline: #include "functions.as" XML.prototype.ignoreWhite = true; var top_nav:Array = new Array(); var my_xml:XML = new XML(); var xml_url:String = "nav/top_nav.xml"; [Code] ..... How I can get needed values out of the onLoad function?
I have a project made in flex, using php data services to access a sql server database, and I need to convert it to mysql, I have changed all my php services from sqlsrv to mysqli. Something like this:
It worked fine on sqlsrv but with mysqli it returns to flex the INT, BIT or DATE values as string the main Datatypes on mysql are INT,VARCHAR,BIT(1),DATETIME,DATE (same as sqlsrv) and on the flex the return types are mainly as object[]
Let's start with the following XML: Code: <swatches> <swatch> <swatchName>Plaid</swatchName> <swatchColors> <color>black</color> [Code] ..... I want to return a list of the <color> values without having any duplicates.
I'm making an activity that involves measuring the depth of a fictitious river at various points. I have an array containing those depths at the various points and a slider for traversing through the depths and outputting to a textfield.
As the user moves the slider up and down, they can see the depth of the river at that point and plot it onto a graph. What I would like to do is be able to figure out the depths inbetween the explicitly defined values.
here is the code, it's pretty simple:
[Code].....
How would I go about figuring out the values inbetween?
In C you can pass a reference to a data item as a parameter to a function. then within the function you can write to that address thus passing back a value to the caller. Can you do anything similar in AS3?
I know you can use the return statement but I want to return a status by that mechanism plus a value in a parameter.
I am trying to connect to an FMS application without flash (no SWF). To the best of my knowledge,the only way to accomplish this is thru the admin APIs, is that correct? If so, how do I return meaningful values from the admin API? I can call functions and stuff using the broadcastMsg API call but I can't seem to get back any values. All that is returned is a useless "Success" type message. I have tried using shared objects and the getSharedObjects API call, but the call doesn't return any info on the contents of the shared objects, just their names and some info on their persistance.
Is there another way of accomplishing my goal outside of the Admin API? If not how do I return meaningful variables from the Admin API? Is there a way to hack or extend the admin API?
How to use charAt for 1 file on more than 1 line? I'm using this relText.load("Count.txt"); // Declaring Releasing Date ( 01.07.07 - 00:00:00 ) var relYear = Number(relDt.charAt(6)+relDt.charAt(7)+relDt.charAt(8)+relDt.charAt(9)); var relMonth = Number(relDt.charAt(3)+relDt.charAt(4))-1; var relDay = Number(relDt.charAt(0)+relDt.charAt(1))-1; var relDate:Date = new Date(relYear, relMonth, relDay, 23, 59, 59, 99);
And Count.txt has 09-21-2009 But I'm wanting to have the actionscript have more than 1 timer in the flash running at the SAME time, due to the fact that I will be having multiple timers for different things. So ideally if I can make the charAt look in the same file just different lines.
AS2 , and I have double checked the names. I am feeding in xml text to a button then trying to check to see if the button has '*' as first character then delete the '*' from the string....
I'm making a hang man app in AS3 and when I try to run or debug it I get this error.
TypeError: Error #1006: charAt is not a function. at Hangman_fla::MainTimeline/loadingText()[Hangman_fla.MainTimeline::frame1:93] at flash.events::EventDispatcher/dispatchEventFunction() at flash.events::EventDispatcher/dispatchEvent() at flash.net::URLLoader/onComplete()
I'm not entirely sure what it all means since I'm extremely new to AS3. So can someone please help me. Also I pasted the code function that charAt is a part of below.
I am taking feed files from an XML, so in order to make those not throw out errors when reading the XML, I convert all entities to their numerical equivalents and write them as "�" for example.This then gets imported into a database, so that it now has "�" in the database.
I then take the text in the database and use that to generate a new XML file, which still contains the "".Flash then reads this XML file and displays the text.Now I think every character is fine (haven't seen all of them, but seen many), including "" (), however, for some reason, the ï symbol refuses to work () and it just displays and not the symbol.
This is really simple, but I can't it after spending 20+ minutes searching on google! I just want a function that turns a number into a character; basically the inverse of mystring.charCodeAt(0). For example-
I am working on a Flex project that is interfacing with physical hardware.Using the AS3 command of socket.send I can set a particular feature on the physical hardware.The problem I am having is I need access to send from the Extended ASCII codes.[code]This would be translated to me sending two numbers to the hardware.7F and 07. The Dec equivalent of these Hex codes are 127 and 7.The hardware takes these two numbers and calculates a length along with a third integer.[code]
Unfortunately the Hex 88 is in the extended ASCII table.The highest the regular goes up to is 7f which is a Dex of 127.I need the ability to send full 0 to 255 numbers in ASCII form.I can't send from 128-255 without using the codes from the ASCII extended table.I get an error every time I try to send something form the extended ASCII table back from the hardware.Can anyone confirm that AS3 does not support the Extended ASCII codes?
I want to create a board class from canvas, which will allow to track click position on it in coordinates like A2, where A...D is Y coordinate in some scale and 1...3 is X coordinate [URL]What I want to create is a kind of convertor from canvas localX and localY to my new coordinates like A2.I am thinking of implementing if condition this way if (0.4 - x*size(from 1-3 here)/canvas.width <= X <= 0.4 + x*size(from 1-3 here)/canvas.width) X = x;
This way I can assigned needed coordinates in X range. e.g. 1, 2 ,3 etc But what to do with alphanumeric range. (if for example I want to make it extensible)...
How can I check if a string has any other character than the ones listed here: [URL]
I would like to know if the string was inputted in any other language than English. Is finding special characters in the string the best way to detect non-english characters?
I'm trying to allow ascii codes to be entered into a textField, using num codes (ALT+Num), and am seeing some very strange behaviour. If I enter: Alt + 14, I get a charCode of 9835, and ♫ is displayed in my trace output, but a placeholder square is entered in the textField. If I enter: Alt + 0014, I get a charCode of 14, placeholder square is displayed in trace, and ♫ is displayed properly in the text field.
I am trying to make a game where if you press down on a letter key, it fires a bullet. How do i assign the fuction to the keypress?[code]90 is the key number for key "z".fireBullet(); is the function to fire the bullet. It is working.
I know letters have a number code to them, or ascii code, how can I use this to trace a letter with a number, for example lets say the ascii code for the letter 'a' is 97, in AS3 is there a way todo something like:
In Sweden we have these characters (and of course also in caps). But my MySQL db can't store characters, so if I look in the db and search for my name, Bostm, i can't find it..The search is ran from within flash (mx2004, and from there to a php-script, wich then sends the matching row back to flash.I want to convert all thein a string, and to be able to reconvert them when flash gets the string back... So the string should be stored in the db with the encoded...(am I confusing you now?)And I can't use the html-code for 'cause if the php-script prints this: Wow... quite an explanation...Ok, short summary:
AS-sting: Bostrm >encode (so that =ASCII or so) >send to PHP-script
use unicode character 187 (hex:BB) or ascii character 174 as a seperation character in my mysql database.This was working great in one of my swf files but not flash keeps reading an extra character. [code]The trace output from this looks like this: 1«1.If I change the php so that it's sending a 1B1 (no special characters) it works ok.I tried using the ASCII version and the Unicode version alt-174 and alt-0187 and both return this extra %2c character.I have tried urlencode from php, but even sending a 1%BB1 provides the same results.I can't fathom why it would all of a sudden start adding extra characters. So should I change my seperation character. If so, what's recommend? If not, should I check every variables from php for this extra character and remove it?