Copy link to clipboard
Copied
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!
...
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 +
Copy link to clipboard
Copied
are you creating an html5/canvas project?
Copy link to clipboard
Copied
It's an html/canvas project that I want to export to a SWF format.
Copy link to clipboard
Copied
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;
}
Copy link to clipboard
Copied
kglad wrote:
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;
}
Thanks for the responses! I created a new file, set to as3 and added the layers that I had previously, using the new action code on the same frame. I was met with the following errors:
Scene 1, Layer 'Layer 3', Frame 1, Line 29, Column 27 1120: Access of undefined property m.
Scene 1, Layer 'Layer 3', Frame 1, Line 29, Column 44 1120: Access of undefined property b.
Scene 1, Layer 'Layer 3', Frame 1, Line 37, Column 5 1120: Access of undefined property m.
Scene 1, Layer 'Layer 3', Frame 1, Line 39, Column 5 1120: Access of undefined property b.
Scene 1, Layer 'Layer 3', Frame 1, Line 39, Column 14 1120: Access of undefined property m.
Thank you again for your assistance!
Copy link to clipboard
Copied
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;
}
Copy link to clipboard
Copied
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!
Copy link to clipboard
Copied
i've never used id, so i don't know the answer to your question. post in the id forum.
the original code is from a fla that published a swf. the code you've been testing in this thread wouldn't be used to publish a swf.
(p.s when using the adobe forums, please mark helpful/correct responses, if there are any.)