Hi Ross, The problem is this line:
var mainBrowserWindow:HTMLLoader; It declares mainBrowserWindow as an HTMLLoader. But HTMLLoader (the class) doesn't have a urlToLoad function, so the compiler gets confused, not knowing mainBrowserWindow is really a BasicBrowserWindow. Replace with this: var mainBrowserWindow:BasicBrowserWindow; and the problem should go away. HTH, Ian On Thu, Dec 11, 2008 at 1:03 PM, Lehr, Ross (N-SGIS) <[EMAIL PROTECTED]> wrote: > This is probably too simple of a question to ask here, but I'm trying to > get my head around this AS3 OOP thing. I'm playing with a simple AIR > (built in Flash) web browser and I've hit a snag right off the bat. I > have a document class that calls a class to build the HTMLLoader window. > If I comment out the code in the onGoEvent function it works fine. When > I uncomment the code and compile, I get a " 1061: Call to a possibly > undefined method urlToLoad through a reference with static type" I know > urlToLoad is there, I use it to load the default page, but for some > reason it gets lost along the way... With my limited knowledge of AS3 > and OOP I just can't find the problem. Thanks for any advice and help. > > urlInput = the text entry field a user would typ the URL address to a > web page. > > PS. I've removed some of the code like the "import" statements to keep > the email as small as possible. > > DOCUMENT CLASS > > package { > > public class MyBrowser extends MovieClip { > > var mainBrowserWindow:HTMLLoader; > > public function MyBrowser() > > { > > mainBrowserWindow = new > BasicBrowserWindow(this,10,45,stage.stageHeight - > 100,900,"http://www.yahoo.com"); > > //goButton > > goButton.addEventListener(MouseEvent.CLICK, onGoEvent); > > } > > public function onGoEvent(e:MouseEvent):void > > { > > mainBrowserWindow.urlToLoad( urlInput.text ); > > } > > } > > } > > BasicBrowserWindow CLASS > > package { > > public class BasicBrowserWindow extends HTMLLoader { > > var htmlLoader:HTMLLoader = new HTMLLoader(); > > public function BasicBrowserWindow(mC:MovieClip, > xPos:int, > yPos:int, > browserH:int, > browserW:int, > defaultURL:String) > > { > > htmlLoader.x = xPos; > > htmlLoader.y = yPos; > > htmlLoader.width = browserW; > > htmlLoader.height = browserH; > > mC.addChild(htmlLoader); > > urlToLoad(defaultURL); > > } > > > > public function urlToLoad(uTL:String):void > > { > > htmlLoader.load(new URLRequest( uTL )); > } > > } > > } > _______________________________________________ > Flashcoders mailing list > Flashcoders@chattyfig.figleaf.com > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > _______________________________________________ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders