?
Solved

Flash Button AS3 Error:  1180 Call to a possibly undefined method

Posted on 2009-07-15
8
Medium Priority
?
1,710 Views
Last Modified: 2013-11-11
I am creating a very simple button using flash.  I would like to link it to a webpage.  But for some reason, I am getting an error when I try to export the file.  If I test the code before exporting, it says that I have no errors, but once I export it, I get the following errors:

1180 Call to a possible undefined method on
1180 Call to a possible undefined method getURL

Am I missing something?  Should there be other code associated with the button?

on("Release") {
getURL("/chrysler/default.aspx");
}

Open in new window

0
Comment
Question by:deeayrian
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 3
8 Comments
 
LVL 2

Expert Comment

by:SaWey
ID: 24860864
I see you are using AS3, so the getURL function is depricated.
You should use something like this:
your_btn.addEventListener(MouseEvent.CLICK, your_btn_function);
var your_button_request:URLRequest = new URLRequest("/chrysler/default.aspx");
 
function your_btn_function(event: MouseEvent){
    navigateToURL(your_button_request, "_self");
}

Open in new window

0
 

Author Comment

by:deeayrian
ID: 24861123
To SaWey -
Is the code I have below correct?  
I am getting other errors now:

The class or interface 'URLRequest' could not be loaded.  
The class or interface 'MouseEvent' could not be loaded.  
Sytax error - navigatetoURL(
chrysler_btn.addEventListener(MouseEvent.CLICK, chrysler_btn_function);
var chrysler_btn_request:URLRequest = new URLRequest("/chrysler/default.aspx");
 
function chrysler_btn_function(event: MouseEvent){
    navigateToURL("/chrysler/default.aspx", "_self");

Open in new window

0
 
LVL 2

Expert Comment

by:SaWey
ID: 24861229
No, this would be the right code:
chrysler_btn.addEventListener(MouseEvent.CLICK, chrysler_btn_function);
var chrysler_btn_request:URLRequest = new URLRequest("/chrysler/default.aspx");
 
function chrysler_btn_function(event: MouseEvent){
    navigateToURL(chrysler_btn_request, "_self");
}

Open in new window

0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 2

Expert Comment

by:SaWey
ID: 24861310
But seeing the error messages it seems you are not using ActionScript3 (as your question is tagged)
If it isn't AS3,  this should be the solution: (remove the quotation marks)

on(release) {
   getURL("/chrysler/default.aspx");
}

Open in new window

0
 

Author Comment

by:deeayrian
ID: 24862733
This is making me crazy.  It seems like it should be super simple!  
I was switching back and forth between AS3 and AS2 so I apologize for the confusion early.   However it was not the true source of my problem.  Even when I put the right style of code with the correct AS version, I get errors.

Now I have chosen to use AS2 code due to its simplicity.  I am attaching my flash file in hopes that you can see something that I am missing.  Now my errors says that my button is not a button instance.  However, I did create a button so I am not sure what else I can do to make it work.

I've also increased the points for this questions.

You will need to change the ext. of the attached file from .zip to .fla in order to see it.
Thanks!
chrysler.zip
0
 
LVL 2

Accepted Solution

by:
SaWey earned 2000 total points
ID: 24862909
I don't know what the problem exactly is, but remove the 'chrysler' button object from your stage and library and do as described below:

Drag/drop 'chrysler_btn.gif' to your stage -> covert to symbol -> select 'button' and click 'ok'
doubleclick the newly created button -> insert frame in 'over' state -> replace image with 'chrysler_btn_f2.gif'
go back to the main stage -> click your button -> open 'actions' -> paste the code (the code was right but on the keyframe and not on the button as it's supposed to be in AS2)

I have attached the solution like you did
on(release) {
   getURL("/chrysler/default.aspx");
}

Open in new window

chrysler.zip
0
 

Author Comment

by:deeayrian
ID: 24863309
Thank you!  I had to recreate my other files from scratch.  For some reason it wouldn't work for me if I just simply deleted the current button from the library.  
My problem seems to be that I am adding the actions to the keyframe instead of the button (like you said).  When I created the file from scratch., I was able to click on the button, open the Actions window and type the code accordingly.  However, when I tried to use my existing file and simply just deleted the current button in the library....I then followed your steps but for some reason, once I finished creating the button, I was unable to just click on it once in the main frame and add code to the Actions window.  It said that actions could not be added to that item.  It would be really helpful if I knew exactly how I was able to ensure I am selecting only the button and adding code to the button instead of the keyframe for future use.  

Thanks so much for your help!!!
0
 
LVL 2

Expert Comment

by:SaWey
ID: 24863504
I'm glad it worked!

Could it be that once you selected the button in the main stage, it wasn't actually a button? That could explain why your were not able to add an action to it.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes a solution to a problem of subloading one movie into another when they have different SWF versions. Sometime back, I was working on an ActionScript project while I came across an interesting fact which I would like to share…
I have been doing hardcore actionscripting for some time; and needless to say I have faced a lot of problems in just understanding others' code rather than understanding what the code executes. A programmer's life can become hell when there are a lo…
In this tutorial viewers will learn how to create a basic motion tween animation in Flash Open a new document in Flash: Draw/import an image: Press CTRL + F8 to convert it into a graphic symbol: Select a frame (how long you want the tween to last): …
The goal of the tutorial is to teach the user how to select which audio input to use. Once you have an audio input plugged into the laptop or computer, you will go into the audio input settings and choose which audio input you want to use.
Suggested Courses

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question