0
votes

I have an AS3 class with some getVideo function. I want to use this function in mxml. So I am creating object there and trying to call the function, but I get this error:

Call to a possibly undefined method.

How can I use my functions in mxml?

My AS3 :

public class InitVideoSound 
    {
        var video:Video = new Video();

        public function InitVideoSound()
        {...}

        public function getVideo():Video {
            return video;
        }

My mxml :

<fx:Script>
        <![CDATA[           

            var ivs1 : InitVideoSound;

            public function init(){
            ivs1.getVideo();

            start.enabled = false;
            }
        ]]>
    </fx:Script>
1
Everything looks correct. Are you sure that is the line that causes the error? - Sam DeHaan
Why is start.enabled = false; in your code snippet? Your code snippets are difficult to debug, as you provide little more than headers, and then a random extra line that seems irrelevant. Try revising them, or provide more information. - Sam DeHaan
It doesn't matter. The question is why IDE says that there is no such function in my class. - pomkine

1 Answers

0
votes

Try this

<fx:Script>
        <![CDATA[           

            var ivs1 : InitVideoSound = new InitVideoSound() ;

            public function init(){
            ivs1.getVideo();

            start.enabled = false;
            }
        ]]>
    </fx:Script>

Make sure the neccesary import for classes are done.