PDA

View Full Version : Error 1061 with if block



flashm
May 19th, 2009, 09:47 AM
Hello all

I sorry for my bad english.

I have this kind of problem:




if(activeBtn != null) activeBtn.hideSubMenu();

here i check if the activeBtn is a different than "null" and than i want to call this method - who's existing and it's with "public" definition.

But no matter what i chaking there's always pop this Error "1061: Call to a possibly undefined method hideSubMenu through a reference with static type flash.display:Sprite."

m90
May 19th, 2009, 11:16 AM
But according to your error message activeBtn is a instance of Sprite. So it propably has no method like hideSubMenu. If you want to use your custom class you have to instantiate your activeBtn as an object of your custom class instead of Sprite.

Krilnon
May 19th, 2009, 12:40 PM
Or you might just need to cast it: (activeBtn as WhateverClassIt_sSupposedToBe).hideSubMenu();

flashm
May 19th, 2009, 03:25 PM
10x a lot ... i solve my problem ! big thanx