PDA

View Full Version : gotoAndStop error



sstark
May 26th, 2009, 03:10 PM
Hello,

I am curious if anyone has found a solution for this very problematic bug...

I have a timeline of labels, with keyframes on each label. The content of each movieClip on the label has an instance name (region_x), AND a custom class name (random_x) with a base class of the standard MovieClip class.

All my code is doing is gotoAndStop(label), and it produces this error:


TypeError: Error #1034: Type Coercion failed: cannot convert random_2@2eac4c41 to random_5.

at flash.display::MovieClip/gotoAndStop()
at com.kidriot.avatar::Creator/stopAllParts()[C:\kidriot\tokiworld_libs\lib\com\kidriot\avatar\C reator.as:428]
at com.kidriot.avatar::Creator/tempTokiEnter()[C:\kidriot\tokiworld_libs\lib\com\kidriot\avatar\C reator.as:208]
if I take off the instance names, no error.

If I do not give them a custom class name, no error.

...however neither of those solutions are viable in my case. I need these MC's to have an instance name AND a custom class name, without this error when using gotoAndStop()... any ideas?

GrndMasterFlash
May 26th, 2009, 04:06 PM
i think your error is that your trying to use randome_5 as your new gotoAndStop location, SO! if my guess is true all you should need to do is first cast random_x(5) as a String,


var location:String = String(random_x);

sstark
May 26th, 2009, 04:09 PM
no, I am going to the frame label. Thank you, but that is not the issue. This is a flash bug, not a code change.


The ONLY solution I can see is to remove the region_x instance name, however... this means that I still need to track the region # I am dealing with, thus I would have to manually create each random_x class with a variable that defines the region #. This would be ok, except that I have 100's (soon 1000's) of random_x class', and I need the class names in my code. (These class names are created automatically via a custom JSFL script)

FYI - when I use 'x', I mean there is an unknown number there.

library items or timeline items should really come with tagging.

sstark
May 26th, 2009, 04:18 PM
Oh, I should also mention:

The code works! The only problem is that this error is displayed about 60 times. Acceptable if I could be assured users do not have the debug player, but I do not want to assume that.

Ning
May 27th, 2009, 02:07 AM
I think, the issues caused by the same instance name of movieclip that you defined as custom class.

sstark
May 27th, 2009, 01:05 PM
I've been trying to re-create the issue in a separate file and I can't...