Creative COW SIGN IN :: SPONSORS :: ABOUT US :: CONTACT US
ADOBE FLASH: HomeFlash ForumFlash TutorialsFlash Video TutorialsWeb Streaming ForumAdobe FlashPodcast

Re: Keeping track of time in Flash

Cow Forums : Adobe Flash
VIEW POSTS   •   ADD A NEW POST   •   SEARCH   •   CHANGE FORUM
Respond to this post   •   Return to posts index   •   Read entire thread


Re: Keeping track of time in Flash
by Sam Mattern on Dec 4, 2008 at 1:48:20 pm

Post an example of what you're trying to do. Concatenation only applies to strings, so if you're trying to take 0.01234 and make it 0.0123456789, you could try (I haven't tested this):
var sDecimal1:String = "01234";
var sDecimal2:String = "56789";
var concatDecimal:Number = Number( "0."+sDecimal1+sDecimal2 );
trace(concatDecimal);//should display 0.0123456789


So if you have your decimal numbers already, you would make them strings by:
var sDecimal1:String = firstNumber;
var sDecimal2:String = secondNumber;
var concatDecimal:Number = Number( "0."+sDecimal1.slice(sDecimal1.indexOf(".")+1)+sDecimal2.slice(sDecimal1.indexOf(".")+1) );


Conceivably, once again not tested, how this works is stores each number as a string. Problem is, they both conceivably have some whole number in front of them, such as 0 or anything. So we slice each one AFTER the "." and then add them together. See if this works. The other option, of course, is figuring out the actual math behind it.

-Sam


Respond to this post   •   Return to posts index   •   Read entire thread


Current Message Thread:




Note: If you are a registered user please click here to login before posting.

Your post will not be accepted if your name and email address are not registered in our database. Click here if you do not have an account.

Name
E-Mail Address
Subject
E-Mail me when someone responds
Just This Message   Entire Thread   None  

Message:



Note: The following are HTML characters and may cause parts of your post to disappear if not used correctly: < > &
To include any portion of the post in your response, highlight the desired text and hit the "Q" key. Read more...



Add your message signature


 


Note: By clicking "Post Direct" button above, you are agreeing to the Creative Cow's Code of Conduct.



FORUMSTUTORIALSMAGAZINETRAININGVIDEOS - REELSPODCASTSEVENTSSERVICESNEWSLETTERNEWSBLOGS

© CreativeCOW.net All rights are reserved.

[Top]