html5 export is 1 pixel out

Explorer ,
May 18, 2021 May 18, 2021

Copy link to clipboard

Copied

Hello, I have an issue with exporting a display banner. The file is set to 160 pixels wide but keeps exporting as 159 pixels. I could fix this in the code but it has a border that gets chopped. 

Side request, any examples of adding a border in html code for these banner files, am not sure where it goes, my attempts so far have failed. I know it's simple but I'm coding illiterate.

 

Code:

<!DOCTYPE html>

<!--

NOTES:

1. All tokens are represented by '$' sign in the template.

2. You can write your code only wherever mentioned.

3. All occurrences of existing tokens will be replaced by their appropriate values.

4. Blank lines will be removed automatically.

5. Remove unnecessary comments before creating your template.

-->

<html>

<head>

<meta charset="UTF-8">

<meta name="authoring-tool" content="Adobe_Animate_CC">

<title>160x600-WM-FA</title>

<!-- write your code here -->

<script src="https://code.createjs.com/1.0.0/createjs.min.js"></script>

<script src="160x600-WM-FA.js"></script>

<script>

var canvas, stage, exportRoot, anim_container, dom_overlay_container, fnStartAnimation;

function init() {

canvas = document.getElementById("canvas");

anim_container = document.getElementById("animation_container");

dom_overlay_container = document.getElementById("dom_overlay_container");

var comp=AdobeAn.getComposition("3966D90D3D9340EF9872B1264627EB53");

var lib=comp.getLibrary();

var loader = new createjs.LoadQueue(false);

loader.addEventListener("fileload", function(evt){handleFileLoad(evt,comp)});

loader.addEventListener("complete", function(evt){handleComplete(evt,comp)});

var lib=comp.getLibrary();

loader.loadManifest(lib.properties.manifest);

}

function handleFileLoad(evt, comp) {

var images=comp.getImages();

if (evt && (evt.item.type == "image")) { images[evt.item.id] = evt.result; }

}

function handleComplete(evt,comp) {

//This function is always called, irrespective of the content. You can use the variable "stage" after it is created in token create_stage.

var lib=comp.getLibrary();

var ss=comp.getSpriteSheet();

var queue = evt.target;

var ssMetadata = lib.ssMetadata;

for(i=0; i<ssMetadata.length; i++) {

ss[ssMetadata[i].name] = new createjs.SpriteSheet( {"images": [queue.getResult(ssMetadata[i].name)], "frames": ssMetadata[i].frames} )

}

exportRoot = new lib._160x600WMFA();

stage = new lib.Stage(canvas);

stage.enableMouseOver();

//Registers the "tick" event listener.

fnStartAnimation = function() {

stage.addChild(exportRoot);

createjs.Ticker.framerate = lib.properties.fps;

createjs.Ticker.addEventListener("tick", stage);

}   

//Code to support hidpi screens and responsive scaling.

AdobeAn.makeResponsive(false,'both',false,1,[canvas,anim_container,dom_overlay_container]);

AdobeAn.compositionLoaded(lib.properties.id);

fnStartAnimation();

}

</script>

<!-- write your code here -->

</head>

<body onload="init();" style="margin:0px;">

<div id="animation_container" style="background-color:rgba(255, 255, 255, 1.00); width:159px; height:600px">

<canvas id="canvas" width="159" height="600" style="position: absolute; display: block; background-color:rgba(255, 255, 255, 1.00);"></canvas>

<div id="dom_overlay_container" style="pointer-events:none; overflow:hidden; width:159px; height:600px; position: absolute; left: 0px; top: 0px; display: block;">

</div>

</div>

</body>

</html>

 

Views

77

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
May 18, 2021 May 18, 2021

Copy link to clipboard

Copied

LATEST

... update, I did a bandaid fix, made the document 161px then remved the extra pixel in the code. Would still like to know why it was happening for future reference.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines