| Home | Register | FAQ | Members List | Search | Today's Posts | Mark Forums Read |
|
|
#1 (permalink) |
|
Professional Idiot
Join Date: Aug 2006
Location: Uk
Posts: 59
|
CS3 geturl buttons
I'm trying to get a button to link to a url in a new window and I keep getting syntax errors etc etc, I'm using: mybutton.onRelease = function() { getURL("http://www.adobe.com", "_blank", "GET"); }; "mybutton" is the symbols name. I get the following error: "Access of undefined property mybutton" "call to a possibly undefined method getURL" what the fucks wrong? I've defined mybutton and what not |
|
|
|
|
|
#5 (permalink) |
|
Senior Member
|
that means you've closed more brackets than you've opened. It's not AS3 by the way: You can't use onRelease in AS3 anymore. It's all eventDispatcher now. Neither can you use getURL in AS3, it's URLRequest now. Perhaps you're better off compiling it as AS2 |
|
|
|
#6 (permalink) |
|
Professional Idiot
Join Date: Aug 2006
Location: Uk
Posts: 59
|
Could you post the basic AS3 code just to link to a web url with a target as _blank in a stand alone file not embeded in another or anything fancy? edit: ok got this out of the adobe documentation: function gotoAdobeSite(event:MouseEvent):void { var adobeURL:URLRequest = new URLRequest("http://www.adobe.com/"); navigateToURL(adobeURL); } mybutton.addEventListener(MouseEvent.CLICK, gotoAdobeSite); but i get the following error: 1120: Access of undefined property mybutton. Why the fuck is it so difficult to make a basic link!?! Last edited by Dirti : 05-06-2007 at 13:59. |
|
|
|
#10 (permalink) |
|
Registered User
Join Date: Jun 2007
Posts: 1
|
correction and step by step instruction
In reply to Dirti's comments, URLRequest is an object, where as getURL is a function. navigateToURL() is the current getURL() which takes an URLRequest object instead of strings. 1. first create the button 2. then rename the button under properties tab of your property box usually located lower part of your screen on a Mac OS. Windows.... been so long i don't even remember. 3. then in the actionscript of the **current frame**, not the button object, you input: function gotoAdobeSite(event:MouseEvent):void { var adobeURL:URLRequest = new URLRequest("Enter your URL here"); navigateToURL(adobeURL); } mybutton.addEventListener(MouseEvent.CLICK, gotoAdobeSite); Where as "gotoAdobesite" is your event function, you can name it anything really instead of "gotoAdobesite", Just have to change them at both instances on the code above. "mybutton" is the the name you assigned to the button in step 2. You can directly create an object when you using navigateToURL functin like this: navigateToURL(new URLRequest("Enter your URL here")); which will replace: var adobeURL:URLRequest = new URLRequest("Enter your URL here"); navigateToURL(adobeURL); the fucntionality and steps are almost exactly the same in both causes, except first one have no referrence to the object created and save a few sec of typing hehe. If you want to do more funky stuff, I would suggest googling "navigateToURL" and "URLRequest" The new actionscript is basically java in my opinion hehe. Happy coding folks, ZW |
|
![]() |