473,396 Members | 2,102 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Linking buttons to URL. Something is wrong. Please help!

9
Ok, from the title you can probably tell im a beginner to Flash.
I'm using CS3, and am trying to create a "menu" to this one webpage.

I did 4 animated buttons, but now im having problems making them link to my pages. I will describe with details what I did:

First, I thought about select the button, and go to the Action panel and enter the script over there. For my surprise, when I try to type it in the action script 3, it comes up with the message "Current selections cannot have actions applied to it".

Then, second thing I did, was to go to my main project, add labels to all my buttons (b_1, b_2, b_3 and b_4), add a Layer, and on the first frame of this new layer, I go to the action panel and tryied the following sintaxe for my script:

Expand|Select|Wrap|Line Numbers
  1. function onCompanyClick(evt:MouseEvent):void {
  2. getURL("company.html");
  3. }
  4. b_1.addEventListener(MouseEvent.CLICK,onCompanyClick);
  5.  
So you understand, the b_1 is the instance name of my first button (which is called Company), and I did repeat that for all other buttons.

At first I was positive it was going to work, but then when i try to publish, it says the there is something wrong with the "getURL("company.html") part of the code. It's probably becuase thats not the correct syntax to call a webpage using Action Script 3.0 (I dont have any AC experience, my programming skills are from other languages, and I'm just experimenting on flash).

So, if anyone can help me, what would be the right syntaxe to call my webpage on that function? And also, why cant I just add it to the button?

Thanks for any help
Jun 13 '07 #1
9 5311
Motoma
3,237 Expert 2GB
Take a look at this page. It has information on the changes that were implemented in Flash 9 as far as getURL is concerned.
Jun 13 '07 #2
Tiruak
9
Take a look at this page. It has information on the changes that were implemented in Flash 9 as far as getURL is concerned.
Thanks Motoma, it has a nice explanation on the link, but I'm still having problems.

im using the following code:

Expand|Select|Wrap|Line Numbers
  1. b_1.addEventListener(MouseEvent.CLICK, callCompany);
  2. function callCompany():void {
  3.     var myurl:String = "http://www.geekavailable.com";
  4.     var myrequest:URLRequest = new URLRequest(myurl);
  5.     navigateToURL(myrequest);
  6. }
  7.  
And I'm receiving this error message on the output window when I try to click the button:

ArgumentError: Error #1063: Argument count mismatch on header_menu_fla::MainTimeline/callCompany(). Expected 0, got 1.

So now, I'm assuming I passed an argument I shouldn't, but my lack of knowledge on the language doesn't let me find what it is.

Any other tips?
Jun 13 '07 #3
Tiruak
9
Well, actually i got it to work.
What was missing is the function definition as a mouse event. So correct code is:

Expand|Select|Wrap|Line Numbers
  1. b_1.addEventListener(MouseEvent.CLICK, callCompany);
  2. function callCompany(event:MouseEvent):void {
  3.     var myrequest:URLRequest = new URLRequest("mycompany.html");
  4.     navigateToURL(myrequest);
  5. }
  6.  
Thanks anyways.

I just dont understand why Adobe did this kind of change on simple funcionts like getURL and some others. For experts it may be easy to figure out, but for me was just a pain in the butt.
Jun 13 '07 #4
Motoma
3,237 Expert 2GB
I am glad you have found your solution. Thank you for posting the correct code. You are welcome back here anytime you have a question, or feel like answering someone else's.
Jun 13 '07 #5
Phat
2
can someone tell me how i could properly add an href tag to this?
i want my link to open on the same browser , not a different one each time and this didn't work:

btnLocation.addEventListener(MouseEvent.CLICK, callLocation);
function callLocation(event:MouseEvent):void
{
var myrequest:URLRequest = new URLRequest("http://alpha.cvscardio.com/Locations.aspx");
navigateToURL(myrequest,'_self');
}
Jun 14 '07 #6
Motoma
3,237 Expert 2GB
can someone tell me how i could properly add an href tag to this?
i want my link to open on the same browser , not a different one each time and this didn't work:

btnLocation.addEventListener(MouseEvent.CLICK, callLocation);
function callLocation(event:MouseEvent):void
{
var myrequest:URLRequest = new URLRequest("http://alpha.cvscardio.com/Locations.aspx");
navigateToURL(myrequest,'_self');
}
You cannot navigate the special windows "_self", "_top", or "_parent" if your SWF file is contained by an HTML page that has set the allowScriptAccess to "none", or to "sameDomain" when the domains of the HTML file and the SWF file do not match.

You will have to change your embed tag to have the AllowScritpAccess set, as well as add a param tag to do the same thing.
Jun 14 '07 #7
Phat
2
that did not work for me.. i changed the allowscript to always

I'm new to all this, thanks for your help.

any other ideas?
Jun 14 '07 #8
Motoma
3,237 Expert 2GB
Heh...Google maybe? I don't have Flash 9 so my web-spelunking will be just as effective as yours.
Jun 14 '07 #9
Motoma
3,237 Expert 2GB
If you find the answer, it would be nice to know what the solution is.
Jun 15 '07 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: nam | last post by:
could someone please help me with this bizarre problem - I've created a swf file at the top of my html page. The swf file (using Swish) is simply a menu of 5 links to 5 anchor points on the html...
0
by: Eric | last post by:
I have the following function which creates buttons on Excel commandbar. The problem i can't get the buttons to hook up to events. For example, if i create four buttons only the fourth one fires...
3
by: Racket | last post by:
Buttons down the left A, B, C, D A graphic to the right. As you hover over A or B etc the graphic on the right changes. It's a common one. Need a script to do this, with or without...
27
by: Lee Phillips | last post by:
I believe it is universally accepted that decorating your website with images from someone else's, without permission, is rude and unethical, even if the images are in the public domain, because...
0
by: gasturbtec | last post by:
please help im new at access programming and i just got this project dropped in my lap because the old programmer quit. i've been doing ok so far but now i need to add code to an existing database...
2
by: longtim | last post by:
I have been trying to implement navigation buttons for a number of forms in my application. Creating the 'Next' 'Previous' buttons has been fine but setting the enabled properties doesn't work...
0
bilal12pk
by: bilal12pk | last post by:
Hi everyone i am looking for (Button Linkings) i want to make a link with button if it will clicked then control panel will open. Also looking for a webpage linking on the buttons and texts so please...
4
by: silverleaf | last post by:
I'm starting to learn how to use the Allegro library with C++ on my own. My compiler is MSVisual C++ 6.0. The book I am learning out of is "Game Programming All In One, Third Edition" by Jonathan...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.