Search Unity

Flash: Convert string to float/double/int

Discussion in 'Flash' started by Fr0sZz, Jan 2, 2012.

  1. Fr0sZz

    Fr0sZz

    Joined:
    Jul 20, 2011
    Posts:
    11
    How do you convert a string to a float in flash. When i try this
    Code (csharp):
    1. System.Convert.ToSingle("123")
    i get this error.
    Code (csharp):
    1.  D:\Fr0sZ\Unity\Funny Marbles\Funny Marbles 4\Temp\StagingArea\Data\ConvertedDotNetCode\global\SpawnGhosts.as(40): col: 92 Error: Access of undefined property Convert.
    2.  
     
  2. Fenyx4

    Fenyx4

    Joined:
    Aug 5, 2010
    Posts:
    23
    I'm getting a similar problem. Anyone found a workaround for this?
     
  3. Lucas Meijer_old

    Lucas Meijer_old

    Joined:
    Apr 5, 2008
    Posts:
    436
    try float.Parse("123");
     
    gk104 likes this.
  4. tripknotix

    tripknotix

    Joined:
    Apr 21, 2011
    Posts:
    738
    In flash they use Number, in place of single float and double

    not sure if that helps, perhaps they havent yet supported it
     
  5. Fr0sZz

    Fr0sZz

    Joined:
    Jul 20, 2011
    Posts:
    11
    Thanks That Works
     
unityunity