Copy link to clipboard
Copied
i need some help with conversion: I have been a long time user of flash and actionscript but now I have to think ahead and all my AS3 scripts need to be converted to .js html5. So I am new to the platform ".js/canvas" I want to continue to use animate CC to publish HTML5 content. Below is the script in Actionscript 3 (which works) can anyone assist me on converting the below script. to adobe animate CC html5. I am willing to supply files if needed: so my enviroment is a closed network" and I am parsing out jackpot information from a XML paramater name see below:
so the paramater that I am linking to is called jackpot_powerball which is in a XML and the value is submitted like 680000000
without commas. or dollar sign: my script below adds the dollar sign & commas
var amt23Check:Number = Number(root.loaderInfo.parameters.jackpot_powerball);
if (amt23Check > 999999999)
{
var PB_JP_Num = formatAsDollars(Number(root.loaderInfo.parameters.jackpot_powerball)/1000000000,0);
var PB_JP_3did = PB_JP_Num.substring(0,5);
PB_JP.text = PB_JP_3did + " BILLION";
}
else
{
var PB_JP_Num1 = formatAsDollars(Number(root.loaderInfo.parameters.jackpot_powerball)/1000000,0);
var PB_JP_3did1 = PB_JP_Num1.substring(0,5);
PB_JP.text = PB_JP_3did1 + " MILLION";
}
function formatAsDollars (amount:Number, removeDec:int):String {
// return a 0 dollar value if amount is not valid
// (you may optionally want to return an empty string)
if (isNaN(amount)) {
return "$0.00";
}
// round the amount to the nearest 100th
//amount = Math.floor(amount*100)/100;
// convert the number to a string
var amount_str:String = String(amount);
// split the string by the decimal point, separating the
// whole dollar value from the cents. Dollars are in
// amount_array[0], cents in amount_array[1]
var amount_array = amount_str.split(".");
// if there are no cents, add them using "00"
// if (amount_array[1] == undefined) {
// amount_array[1] = "00";
// }
// if the cents are too short, add necessary "0"
if (removeDec == 1) {
amount_array[1] = "";
}
// if the cents are too short, add necessary "0"
// if (amount_array[1].length >= 2) {
// amount_array[1] += "0";
// }
// add the dollars portion of the amount to an
// array in sections of 3 to separate with commas
var dollar_array:Array = new Array();
var start:Number;
var end:Number = amount_array[0].length;
while (end > 0) {
start = Math.max(end - 3, 0);
dollar_array.unshift(amount_array[0].slice(start, end));
end = start;
}
// assign dollar value back in amount_array with
// the a comma delimited value from dollar_array
amount_array[0] = dollar_array.join(",");
// finally construct the return string joining
// dollars with cents in amount_array
if (removeDec == 1){
return ("$" + amount_array[0]);
}
else
{
return ("$" + amount_array.join("."));
}
}
Copy link to clipboard
Copied
function formatAsDollars(n) {
return "$" + (isNaN(n) ? 0 : Number(n)).toLocaleString("en-US", {minimumFractionDigits: 2, maximumFractionDigits: 2});
}
Copy link to clipboard
Copied
i am a bit confused. what about al other code? If I would to upload a .fla source file with code would you be able to format the code for HTML5/.JS in animate? Thank you.
Copy link to clipboard
Copied
I'm not going to do ALL of your job for you. I've already done the hard part. The rest is trivial.
https://helpx.adobe.com/animate/kb/as-to-html5.html
https://helpx.adobe.com/animate/how-to/convert-flash-ads-to-html5.html