ActionScript 3.0 :: Custom MC Property Seen As Number Instead Of String?
Dec 30, 2010
I'm trying to create some custom properties, but for some reason I can't make them Strings. If I give them a string value: "Something" it is returned as NaN by the MC.
But if I give it true; as a value, it is returned as 1.
this is in the class
Code:
public static var Temp_F:labeled_btn = new labeled_btn()
function setting the values
[Code].....
View 2 Replies
Similar Posts:
Aug 25, 2009
i am a bit embarassed to ask this, but i do this so much i have to ask. Occasionally, i need to pass/handle custom events on the fly. Rather than creating a whole custom event class, i will just do something like
Code:
myObject.dispatchEvent(new Event('thisCustomEvent'));
//and then handle it later
[code]....
View 12 Replies
Jan 25, 2010
I couldn't work it out yet...
package components {
public class templateSelection extends VBox {
static public var tempSelectionBag:Dictionary;
[Code]....
I want to have a custom class tempSelection with a Dictionary as a public accessable property of that class. If I use this code, the compiler tells me:
1046: Typ wurde nicht gefunden oder war keine Kompilierungszeit- onstante:Dictionary
Which translates to:
Type was not found or was not a compile-time constant: Dictionary
View 1 Replies
Jun 22, 2011
I have a Custom Component that has a couple of Canvas with some background colors assigned to them. Now i have hard coded the colors, i want to move them to an external css file. So i would like to have the css declaration like this :
[Code]...
My question is if i can define custom style names like dividerRightColor and if so, how can i use that value inside my MXML Component? I have seen examples of using them inside Pure AS components.
View 2 Replies
Oct 9, 2006
how can i convert a string ending in a number to a number? lets say i have a string such as somestring3 how can i convert that to a number 3?
View 7 Replies
Jul 14, 2011
Inside my code i have some variables declared as Numbers, and i get some others from an external source; these variables can either be Numbers or String representation of Numbers. Now, i have to implement some equality controls on these variables, and since i don't know in that moment which type are them of, i'm converting all of them to Numbers (i don't need and neither want to compare strings) via the Number() function which accepts either Numbers or Strings as an input. These controls can compare 2 single variables or a variable and a sum (or subtraction) of other variables, for example:
[Code]....
View 8 Replies
Oct 11, 2009
I created the following AS for a particular frame
Code:
cnx.addEventListener(CNXConnection.DIGITAL, onDigital_10);
function onDigital_10(e:DigitalEvent)
{
[code]....
While debugging everything works properly if I'm testing that frame.But, pushing a button in another frame, I get the following error:
TypeError: Error #1009: Cannot access a property or method of a null object reference at "frame number:raw number"
I'm quite sure that the problem is that the variable e.Join changes its corresponding e.Value pushing a particular button in another frame (as must be). Any ideas how to link that information to the frame that create the error?
View 1 Replies
Dec 28, 2009
Is there a point of creating custom event class if i dont need to pass custom property with that event?
View 3 Replies
Jan 23, 2010
I am new to AS3, as well as Flash in general, so forgive me if this seems highly elementary. All I am trying to do is create a custom class that extends the MovieClip class and contains a custom property of "marker". I want to be able to use and change the value of this custom property on the timeline for an instance of this class and have it behave just like any other (Ex: this.x ==> this.marker).
[Code].....
View 13 Replies
Apr 3, 2009
I'm importing a txt file through my AS and would like to use the string as a value to manipulate my timeline.. for instance ,the 'txt' contains a '0' and I would like to set an 'IF' statement that evaluates that value. this is the code I'm using (it places the value in a dynamic text box for now):[code]I understand that it must be converted from a string to a number, but have been having difficulty with this following other threads.I'm also curious if there is a simple way to continue checking the txt file for changes in value..
View 2 Replies
Aug 31, 2009
I was just working in a Flash file, and an mc was in the top left, with an x vale of around 12px.I copied and pasted that mc into another file, and when I looked back at the first file, the x value was 448.6px.
View 3 Replies
Feb 27, 2010
does anyone know a way to use a string to to retrieve the property with that name?something like...
Code:
var myString:String ="myVarInMovieClip";
var myString2:String ="x";
[code].....
View 2 Replies
Apr 28, 2010
Is there anyway of adding a custom property to a dynamic TextField. [code]...
But, how would I do something similar with a TextField (puting a TextField inside a Sprite or MovieClip is not an option).
View 2 Replies
Jun 28, 2007
I have an FLV player that provides a read-only property called myPlayer.timecode and it displays the time in seconds as a String (xx.xxx).I am trying to assign that value to a variable so I can convert it to a number to use in some calculations, comparisons, etc. I can assign this property to a dynamic text box and display it on the screen, but I cannot assign it to a variable and have the variable value show correctly on the screen. What do I need to do?Ex: myPlayer.timecode value is 10.000 and shows as 10.000 in the dynamic text box called myTime1. (I entered the property into the Var: input box).Created a String variable called timePlayed, and assigned it to a dynamic text box called myTime2.However, I cannot find a way to assign the property myPlayer.timecode to this variable. I can only display a value of "undefined" or "NaN" in the text box myTime2.
View 3 Replies
Jun 12, 2006
Does anyone know an url where I can get the current time as either a string or a number? Or how do I solve the problem that flash can't create an external time? Or does anybody have a
perl-file that they wouldn't mind sharing with me that could do the trick
View 2 Replies
Jul 28, 2009
i have a simple dynamic textbox and want to store the TotalTime-property (= seconds of the video) of my video (flvplayback component) into this textbox. how can this super-easy thing be done?
View 1 Replies
Dec 14, 2010
I have a problem sending a String as a number..
I have a text field called score0 :-
var score = score0.text;
The string (score0.text) will have an "s" at the end as the time is counted in seconds and tenths, so I will be receiving something along the lines of "8.1s" as a value.. I would like to take score0.text, remove the "s" then *1000 the amount as a number before use..
View 3 Replies
Jan 4, 2011
I want to convert a textbox value to numric value and i use a code like this :var n:Number = Number(myTextbox.text);when i trace the variable (n) it gives me 0. although when i trace myTextbox.text , it gives me the right value.
View 1 Replies
Jul 28, 2011
Im looking to be able to find a number (any number) within a text string, what i ultimately want to do is crop the number out of the string to just be left with a number value, the only problem is the string could be any length and the number doesnt necessarily start at any point from the last characterI have items on the stage named 'image0', 'textfield2', 'button500' etc, as you can see the prefix before the number isnt a fixed length so I couldnt use substr and set an index, and since the number could be any number i couldnt set the index as a certain value before the end of the string. (ie it might return '500' or 'ld2' or 'ge0' in the examples given before)
View 4 Replies
Oct 3, 2011
If i had a string "2 cats", how could i use a loop andif statement to check if there is a number in there
I have this so far:
for (var i:Number=0; i<string.length; i++){
if(equation.charCodeAt(i) <= 57)
{if(equation.charCodeAt(i) >= 48)
[Code]....
It does work, but is there a more efficent qway of doing this?
View 9 Replies
Oct 18, 2011
how do I target a VAR using a string and Number, the idea is that i can chnage the number to target that VAR.
var gogo1:Number = 12
var gogo2:Number = 89
trace("gogo" + 2)
[code]....
View 4 Replies
Dec 6, 2010
I have an input field which requires a number to be entered.
I don't want the entry to start with a zero.
How would I check that the field has not been started with a zero?
View 1 Replies
May 27, 2011
I'm trying to convert a string to number and no matter what I do, get strings still.
var lastDigit:Number = Number(e.target.name.charAt(e.target.name.length-1));
trace ('lastDigit is number = ' + lastDigit is Number)
And this traces false. I also tried parseInt and get a type coercion error.
View 4 Replies
Oct 26, 2011
I have buttons with id's button1, button2, button3, etc.
I have a for loop that i need to loop starting with a number and i need to enable buttons based on my loop. I need help taking my string button1 and making that the id "button1" so i can use the button property's.
View 1 Replies
Feb 16, 2009
Which way is the right way to convert a number to string?
ActionScript Code:
var aNumber:Number = new Number(25);
var aString:String = new String();
///////// THIS ///////////
[Code]....
View 8 Replies
Nov 8, 2009
I have a bunch of sequential movie clips (mc1, mc2, mc3, mc4, mc5, etc...).
I use the following code to set them to buttons.[code]...
What I want to do, is get the NUMBER that is clicked from the mc name (eg. mc5 returns 5, mc3 returns 3, mc908 would return 908, you get the point...)
View 1 Replies
Oct 30, 2010
How can I convert a variable of type string to type Number???eg "0.3" to 0.3"3" to 3
View 2 Replies
Oct 5, 2011
I am trying to get numbers from a string and have tried number(), int(), parseInt() BUT....it all works fine but they all seem to accept as a number which appears throughout the text which then messes up the calculations. Is there anyway to force it to only accept 0-9 digits?
View 2 Replies
Mar 3, 2005
I want to take a string that contains numbers and search for a specific number within that string.
For example, my string is "0 1 3." I want to check to see if the number 3 appears within this string.
View 7 Replies
Apr 8, 2005
i have two strings a = 11 b =12 i want their sum,
i wrote
var sum:Number = a + b ;
its giving me 1112 as oppsed to 23. how do i do it ???i tried sum = new Number(a ) + new Number (b )
View 4 Replies