Skip to main content
alia_klei
Inspiring
December 15, 2016
Answered

Jsfl: element.width and element.left have junk values

  • December 15, 2016
  • 4 replies
  • 1503 views

After upgrading to Animate CC from Flash 2.0 and trying to run our re-exporter I noticed that a lot of the time the element.width and element.left sometimes have some bad values in them. Strangely element.height and element.top do not seem to contain such bad values.

Is there a work around for this or a patch?

I noticed there was thread from 2014 but it was marked answered but without a satisfactory outcome.

Thanks!

- alia

This topic has been closed for replies.
Correct answer alia_klei

I have a work around! I noticed that if you click on a frame that section gets valid values. Such an odd way to do things!

So the workaround is to force the current frame / selection elements before you access their data!

            // Need to make sure we set the frame or the data is corrupt

            fl.getDocumentDOM().getTimeline().currentFrame = frame_idx;

            var frame = layer.frames[frame_idx]

            if (frame)

            {

                var elements = frame.elements

                var num_elem = frame.elements.length

               

                // Need to make sure we set the selection or the data is corrupt

                fl.getDocumentDOM().selection = elements;

4 replies

alia_klei
alia_kleiAuthorCorrect answer
Inspiring
December 16, 2016

I have a work around! I noticed that if you click on a frame that section gets valid values. Such an odd way to do things!

So the workaround is to force the current frame / selection elements before you access their data!

            // Need to make sure we set the frame or the data is corrupt

            fl.getDocumentDOM().getTimeline().currentFrame = frame_idx;

            var frame = layer.frames[frame_idx]

            if (frame)

            {

                var elements = frame.elements

                var num_elem = frame.elements.length

               

                // Need to make sure we set the selection or the data is corrupt

                fl.getDocumentDOM().selection = elements;

alia_klei
alia_kleiAuthor
Inspiring
December 15, 2016

I wish I could just upload the old and new flash files to show the difference

kglad
Community Expert
Community Expert
December 15, 2016

i don't a problem:  width,height,left.top all work as expected for me except for shapes where i see as more than one individual shape, jsfl only sees one shape.  it reports accurate data about that one shape but it's unexpected (by me) that it would fail to see several shapes/elements.

alia_klei
alia_kleiAuthor
Inspiring
December 15, 2016

My problem has not been resolved. Why is this marked correct?

alia_klei
alia_kleiAuthor
Inspiring
December 15, 2016

As in you can get element.width and element.left to not sometimes be broken? or you don't see that I could have a problem?

kglad
Community Expert
Community Expert
December 15, 2016

are those symbols or shapes?

with shapes, you'll get one element returned by the jsfl.

alia_klei
alia_kleiAuthor
Inspiring
December 15, 2016

Symbols

kglad
Community Expert
Community Expert
December 15, 2016

i don't see a problem.

what are the minimum steps needed to display the problem?