Thanks Sid, it does help... Thanks for the additional advice as well. -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Sidney de Koning Sent: Thursday, December 11, 2008 8:22 AM To: Flash Coders List Subject: Re: [Flashcoders] Probably a simple answer...
Hi Ross, when you create your variables, you forgot to set the identifier, public , private etc. Because else it scopes it default to , if i'm not mistaken. So now change that to (and its good practice to use an underscore for member variables); private var _mainBrowser: BasicBrowserWindow; (not htmlLoader) Also change the mainBrowser everywhere to _mainBrowser, now also do the same trick for the htmlLoader. (set it to private and rename to_htmLoader). That should fix it. Hope this helps you on your way, Sid On Dec 11, 2008, at 2:03 PM, Lehr, Ross (N-SGIS) 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 Sidney de Koning Flash / AIR Developer @ www.funky-monkey.nl Technical writer @ www.insideria.com _______________________________________________ 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