Skip to main content
Inspiring
January 13, 2017
Answered

Animator CC 2017 - Scrollable Text Box Error 1120

  • January 13, 2017
  • 1 reply
  • 580 views

Hello. I'm working on a scrolling textbox that I can import into another project as a SWF file. However, upon exporting the file I get a series of Error 1120 messages. The code that I'm using, I found on another forum post for a scrolling text box here (credit to kglad). I then, edited a few things out for my purposes. The actionscript code works perfectly when I use the Test function, but after that it all becomes a hodge podge mess. My two varieties of error messages and my code are pasted below:

Scene 1, Layer 'Layer 3' Line 1, Column 1 | 1120: Access of undefined property tl.

Scene 1, Layer 'Layer 3' Line 3, Column 1 | 1120: Access of undefined property createjs.

tl = this;

createjs.Touch.enable(tl);

paramF(0, 48, 146 - 20, 48 + 146 - tl.tf.getBounds().height);

tl.sb.thumb.addEventListener('mousedown', startdragF);

function startdragF(e) {

    stage.addEventListener('stagemousemove', dragF);

    stage.addEventListener('stagemouseup', stopdragF);

}

function stopdragF(e) {

    stage.removeEventListener('stagemousemove', dragF);

}

function dragF(e) {

    if (e.stageY >= 48 && e.stageY <= 48 + 146 - 20) {

        tl.sb.thumb.y = Math.floor(e.stageY - tl.sb.y);

        tl.tf.y = Math.floor(tl.m * tl.sb.thumb.y + tl.b);

    }

}

function paramF(x1, y1, x2, y2) {

    tl.m = (y1 - y2) / (x1 - x2);

    tl.b = y1 - tl.m * x1;

}

Any help or suggestions as to fix this code would be greatly appreciated. I'm not super skilled with code, but will do my best.

Thanks!

This topic has been closed for replies.
Correct answer garyb5854400

have to declare those variables:

var m:Number;
var b:Number;

paramF(0, 48, 146 - 20, 48 + 146 - tf.height);

sb.thumb.addEventListener(MouseEvent.MOUSE_DOWN, startdragF);

function startdragF(e:MouseEvent):void {

stage.addEventListener(MouseEvent.MOUSE_MOVE, dragF);

stage.addEventListener(MouseEvent.MOUSE_UP, stopdragF);

}

function stopdragF(e:MouseEvent):void {

stage.removeEventListener(MouseEvent.MOUSE_MOVE, dragF);

}

function dragF(e:MouseEvent):void {

if (e.stageY >= 48 && e.stageY <= 48 + 146 - 20) {

sb.thumb.y = Math.floor(e.stageY - sb.y);

tf.y = Math.floor(m * sb.thumb.y + b);

}

}

function paramF(x1, y1, x2, y2) {

m = (y1 - y2) / (x1 - x2);

b = y1 - m * x1;

}


kglad wrote:

have to declare those variables:

var m:Number;
var b:Number;

paramF(0, 48, 146 - 20, 48 + 146 - tf.height);

sb.thumb.addEventListener(MouseEvent.MOUSE_DOWN, startdragF);

function startdragF(e:MouseEvent):void {

stage.addEventListener(MouseEvent.MOUSE_MOVE, dragF);

stage.addEventListener(MouseEvent.MOUSE_UP, stopdragF);

}

function stopdragF(e:MouseEvent):void {

stage.removeEventListener(MouseEvent.MOUSE_MOVE, dragF);

}

function dragF(e:MouseEvent):void {

if (e.stageY >= 48 && e.stageY <= 48 + 146 - 20) {

sb.thumb.y = Math.floor(e.stageY - sb.y);

tf.y = Math.floor(m * sb.thumb.y + b);

}

}

function paramF(x1, y1, x2, y2) {

m = (y1 - y2) / (x1 - x2);

b = y1 - m * x1;

}

This works and exports with no error!. One last quick question. Is there a way to add this to an interactive InDesign project? I will still be exporting it as a SWF but when the project is viewed as a swf, can the scrollbar work?

Thanks!

1 reply

kglad
Community Expert
Community Expert
January 13, 2017

are you creating an html5/canvas project?

Inspiring
January 13, 2017

It's an html/canvas project that I want to export to a SWF format.

kglad
Community Expert
Community Expert
January 13, 2017

to me that means you're creating an as3 project, not html5/canvas and that would explain the errors.

as3 != javascript/easeljs.  the as3 and javascript are similar, but they're not the same.

for as3:

paramF(0, 48, 146 - 20, 48 + 146 - tf.height);

sb.thumb.addEventListener(MouseEvent.MOUSE_DOWN, startdragF);

function startdragF(e:MouseEvent):void {

    stage.addEventListener(MouseEvent.MOUSE_MOVE, dragF);

    stage.addEventListener(MouseEvent.MOUSE_UP, stopdragF);

}

function stopdragF(e:MouseEvent):void {

    stage.removeEventListener(MouseEvent.MOUSE_MOVE, dragF);

}

function dragF(e:MouseEvent):void {

    if (e.stageY >= 48 && e.stageY <= 48 + 146 - 20) {

        sb.thumb.y = Math.floor(e.stageY - sb.y);

        tf.y = Math.floor(m * sb.thumb.y + b);

    }

}

function paramF(x1, y1, x2, y2) {

    m = (y1 - y2) / (x1 - x2);

    b = y1 - m * x1;

}