header
ask question
Click here to ask Question Now Its free No registration required. Flash, Flex, Flash Media Server, ActionScript,Adobe Air. Most questions receive a response in an hour.
sandy
Points:0
Posts:0

7/29/2010 12:23:28 AM

Title: error conversion


i code the following as as2 to as3

But it raise an error as follows:

Scene 1, Layer 'action', Frame 1, Line 177 1067: Implicit coercion of a value of type String to an unrelated type Number.

can anybody to help me to convert



obj1.txt.addEventListener(FocusEvent.FOCUS_OUT, funFocus)
							function funFocus(evt:FocusEvent):void  //onKillFocus = function() 
							{
								if (evt.target.parent.decimal == 0)
								{
									var noStr:String = String(parseFloat(this.text));
									if (noStr.length<this.maxChars)
									{
										noOfZero = this.maxChars-noStr.length;
										while (noOfZero-->0)
										{
											noStr = "0"+noStr;
										}
									}
									evt.target.text = isNaN(noStr) ? "" : noStr;
								}
								else 
								{
									noStr = String(parseFloat(this.text));

									if (noStr.indexOf(".") == -1)
									{
										noStr += ".";
									}
									if (noStr.length<this.maxChars)
									{
										noOfZero = this.maxChars-noStr.length;
										while (noOfZero-->0) 
										{
											noStr += "0";
										}
									}
									if (noStr.substr(-1) == ".")
									{
										noStr = noStr.substr(0, -1);
									}
									this.text = isNaN(noStr) ? "" : noStr;
								}
							}
						}



1
Friend
Points: 690
Posts:0
7/29/2010 6:09:57 AM



check your source code in line 177 , you must be setting some String Value to Number.
Do the type conversion to Number

var stringVariable:String= Number(someSting);


Post your Reply
Name  

Email

Type your Reply or Answer

Are you human? What is 2+6 



Members Login

Email  
Password
Forgot Password





This website focus on: Flash | Flex | FMS | RED5 | WOWZA | Flash Media Server | Adobe AIR | ActionScript,Flash Solutions | Flash Question | Flash Answers | Flash Developers | Flash Problem, Flash Help, Flash bugs, Flash workaround | Flash Blog | Flex Question Answers | Flash Forum | Flex Development | Actionscript development | Flash development | Adobe AIR development
Copyright © 2008 AskMeFlash.com. All rights reserved. Privacy Policy | Terms & Conditions