Home Tutorials Forums Articles Blogs Movies Library Employment Press

 ActionScript.org Forums Converting a percentage to a decimal (after effects to flash scale conversion)
 Register FAQ Members List Social Groups Calendar Search Today's Posts Mark Forums Read

 04-28-2012, 12:26 AM #1 HarryBrook Registered User   Join Date: Oct 2011 Posts: 18 Converting a percentage to a decimal (after effects to flash scale conversion) Hi All, I have a function that receives scale information each frame as a percentage (from After Effects) that needs to be turned in to a decimal to work in flash. ie. values like 94.2627118644068 need to be 0.94. I've tried this: ActionScript Code: ```if (prop == "Transform_Scale"){ // if cue point is scale related then,                                     var resultsS:Array = val.split(",",[3]);    // splits string into 3 figures of which im interested in only one which is a percentage like 94.2627118644068.                                     faceParent.faceContainer.scaleY = Number(("."+resultsS[1])*10); faceParent.faceContainer.scaleX = Number(("."+resultsS[1])*10); // trying to make it 0.94 and apply to movieclip. };``` Because i am placing a decimal point manually its breaking as theres multiple decimal points along with the percentage decimals. i.e. this is clearly a noob attempt. Is this just basic maths or does it require certain commands in AS3? I'm dealing with percentages that vary from sub 100 to over 100 but below 200. Thanks for reading!
 04-28-2012, 01:03 AM #2 abeall Senior Member   Join Date: Feb 2006 Location: Washington, DC Posts: 2,682 To move the decimal left you need to divide: ActionScript Code: `Number(resultsS[1]) / 100;` __________________ Aaron Beall | Flash portfolio | Fireworks extensions | Twitter

 Thread Tools Display Modes Rate This Thread Linear Mode Rate This Thread: 5 : Excellent 4 : Good 3 : Average 2 : Bad 1 : Terrible

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts BB code is On Smilies are On [IMG] code is On HTML code is Off Forum Rules
 Forum Jump User Control Panel Private Messages Subscriptions Who's Online Search Forums Forums Home ActionScript Forums Group     ActionScript 3.0     ActionScript 2.0     ActionScript 1.0 (and below)     Simple Stuff (Newbies) Flash General Questions     Flash 10 General Questions     Flash 9 General Questions     Flash 8 General Questions     Other Flash General Questions Flex     Flex 2, 3 & 4     Flex 1 Extensions and Plugins     Components     JSFL - Extending Flash Desktop, Mobile and non-browser Environments     AIR (Apollo)     FlashLite / Portable Devices Development     Projectors and CDs Supporting Technologies     HTML and JavaScript     haXe     Server-Side Scripting     Flash Remoting     Flash Media Server General     Best Practices     Gaming and Game Development     Animation and Effects     Flashants Support Forum Community Boards     General Chat     Just for Kicks Challenges     Detention Flash In Action     Site Check     Cool Sites     Widgets Decommissioned     Projects and Positions CMS Forums     Announcements Board     Content Postings / Updates     Product Review Requests     CMS Technical Questions     Process Questions     Collaboration & Suggested Articles

All times are GMT. The time now is 11:39 PM.

///