Вопрос

When I'm tracing a variable in Flash Player Debug, I'm getting a strange behavior. Let's assume that we have a pattern like "x:y". "x" and "y" are integer vars. If we trace that expression with

trace("x:y");

the behavior is

1) if x < 10

"x" variable and ":" will be omitted and only "y" will be printed out

2) if x >= 10

everything works as expected. "x:y" printed out.

Questions:

  1. Why it happens?
  2. Is colon a special character in actionscript?
  3. Is it possible to avoid this behavior and print out for example "1:1"?

To reproduce:

// following looks wrong
trace("1:1");  // 1
trace("2:1");  // 1
//but the next ones - look correct
trace("10:1"); // 10:1
trace("11:1"); // 11:1

Thanks in advance.

Это было полезно?

Решение

Testing this with mxmlc:

// following looks wrong
trace("1:1");  // 1
trace("2:1");  // 1
//but the next ones - look correct
trace("10:1"); // 10:1
trace("11:1"); // 11:1

Produces these results for me:

1:1
2:1
10:1
11:1

Anything else you can post to help narrow the problem down?

Другие советы

Variables should not be in quotation marks. The correct way to trace this would be:

trace(x + ":" + y);

Edit: I'm not sure why it is doing that for you but I am not getting that behavior when tracing inside Flash Pro...

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top