yozhik
yozhik

Reputation: 5074

gotoAndStop(label) fails with error 2109

I have two movie clips:

mov1 has frames with labels in such sequence ("item"," btn", "win", "loose")
mov2 has frames with labels in such sequence (" ", "item", "win", "loose")

This is two standardized movie clips, which are ruled by one class MovItem. In constructor of MovItem I init:

public function MovItem(item_mc:MovieClip )
        {
            this.item_mc.addEventListener( MouseEvent.CLICK, dispatchEvent );

            //this.item_mc.gotoAndStop('btn');
            this.item_mc.gotoAndStop(1);        
        }

In web version all works correctly, but in AIR 2.6 for Android it fails with error:

Error #2109: Frame label btw not found.

on gotoAndStop('btn'); on element which don't have such label.

And when I'm gotoAndStop(1); on this item all works fine. All should be great, but 'btw' label on second movie clip is situated on second frame.

How can I fix it easily without total rework in .fla resources? Why does it works on web application, but on AIR fails? Thanx for you time.

Upvotes: 1

Views: 1737

Answers (1)

George Reith
George Reith

Reputation: 13476

This is actually happening in both the web version and the AIR version because mov2 has no frame called btn.

On the web version you will get a compiler warning but instead of quitting the application it just ignores the gotoAndStop(). However when compiling to AIR the compiler is in strict mode which converts compiler warnings to errors and won't allow you to compile until they are fixed.

It is bad practice anyway to call a function that you know is erronous (especially in a constructor method) so you should ether pass the frame to the constructor as a parameter (if they are going to different frame numbers) or explicitly give it the frame number e.g. gotoAndStop(2) (if they all go to the same frame number).

Also check you haven't misspelt the frame as you refer to the frame as both btn and btw in your question.

Upvotes: 2

Related Questions