Contents
Articles
Behaviors
Books
Director News
Director Web Sites
FAQ
Games
Mailing Lists
News Groups
Project Examples
Reviews
Software
Tools
Useful Web Sites
Utilities
Xtras

Don't miss these
Go Frame X
Volume Controller SWA(Shockwave Audio)
Title Bar Color Gradient Effect Behavior
Outline Text - Imaging Lingo
cXtraEditBox
Hoolicon
lingo to php with browser on stage
aougu.com
Set the location of Sprite
Killer Transitions
 

 

 

Behavior Convert between bases-String to Integer

Added on 6/27/2000

 

Compatibilities:
D7 D8 Mac PC Script Shockwave

Rating:

Author: JoergSeibert

Converts a string to integer based on a set base

--Based on scripts by Kevan Dettelbach and Chuck Neal

--Convert a String into an integer,
--for hex-to-int call convToInt(szConv, 16)
--for bit-to-int call convToInt(szConv, 2)  .....
--no complete errorchecking: convToInt("2EF", 2) works, but makes no sense ;-)
on ConvToInt szConvNum, nBase
  if nBase > 1 and nBase < 17 then
    baseNums = ["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F"]
    nConverted = 0
    nMax = szConvNum.length
    repeat with nIndex = 1 to nMax
      nConverted = nConverted * nBase
      nConverted = nConverted + baseNums.getOne(szConvNum.char[nIndex]) - 1
    end repeat
    return nConverted
  else
    return VOID
  end if
end

 


Contact

MMI
36 South Court Sq
Suite 300
Newnan, GA 30263
USA

Send e-mail